Annotations

BinderScriptNotebook

Summary: This example shows how to create Shapes and add them to the Charts in F#.

let's first create some data for the purpose of creating example charts:

open Plotly.NET 
  
let x  = [1.; 2.; 3.; 4.; 5.; 6.; 7.; 8.; 9.; 10.; ]
let y' = [2.; 1.5; 5.; 1.5; 3.; 2.5; 2.5; 1.5; 3.5; 1.]

use the Annotation.init function to generate a shape, and either the Chart.withAnnotation or the Chart.withAnnotations function to add multiple annotations at once.

open Plotly.NET.LayoutObjects

let a1 = Annotation.init (X=2.,Y=4.,Text = "Hi there!")
let a2 = Annotation.init (X=5.,Y=7.,Text="I am another annotation!",BGColor= Color.fromString "white",BorderColor= Color.fromString  "black")

let annotations =
    Chart.Line(x,y',Name="line")    
    |> Chart.withAnnotations([a1;a2])
namespace Plotly
namespace Plotly.NET
val x : float list
val y' : float list
namespace Plotly.NET.LayoutObjects
val a1 : Annotation
Multiple items
type Annotation = inherit DynamicObj new : unit -> Annotation static member init : ?X:#IConvertible * ?Y:#IConvertible * ?Align:AnnotationAlignment * ?ArrowColor:Color * ?ArrowHead:ArrowHead * ?ArrowSide:ArrowSide * ?ArrowSize:float * ?AX:#IConvertible * ?AXRef:#IConvertible * ?AY:#IConvertible * ?AYRef:#IConvertible * ?BGColor:Color * ?BorderColor:Color * ?BorderPad:int * ?BorderWidth:int * ?CaptureEvents:bool * ?ClickToShow:ClickToShow * ?Font:Font * ?Height:int * ?HoverLabel:Hoverlabel * ?HoverText:string * ?Name:string * ?Opacity:float * ?ShowArrow:bool * ?StandOff:int * ?StartArrowHead:int * ?StartArrowSize:float * ?StartStandOff:int * ?TemplateItemName:string * ?Text:string * ?TextAngle:float * ?VAlign:VerticalAlign * ?Visible:bool * ?Width:int * ?XAnchor:XAnchorPosition * ?XClick:#IConvertible * ?XRef:#IConvertible * ?XShift:int * ?YAnchor:YAnchorPosition * ?YClick:#IConvertible * ?YRef:#IConvertible * ?YShift:int -> Annotation static member style : ?X:#IConvertible * ?Y:#IConvertible * ?Align:AnnotationAlignment * ?ArrowColor:Color * ?ArrowHead:ArrowHead * ?ArrowSide:ArrowSide * ?ArrowSize:float * ?AX:#IConvertible * ?AXRef:#IConvertible * ?AY:#IConvertible * ?AYRef:#IConvertible * ?BGColor:Color * ?BorderColor:Color * ?BorderPad:int * ?BorderWidth:int * ?CaptureEvents:bool * ?ClickToShow:ClickToShow * ?Font:Font * ?Height:int * ?HoverLabel:Hoverlabel * ?HoverText:string * ?Name:string * ?Opacity:float * ?ShowArrow:bool * ?StandOff:int * ?StartArrowHead:int * ?StartArrowSize:float * ?StartStandOff:int * ?TemplateItemName:string * ?Text:string * ?TextAngle:float * ?VAlign:VerticalAlign * ?Visible:bool * ?Width:int * ?XAnchor:XAnchorPosition * ?XClick:#IConvertible * ?XRef:#IConvertible * ?XShift:int * ?YAnchor:YAnchorPosition * ?YClick:#IConvertible * ?YRef:#IConvertible * ?YShift:int -> (Annotation -> Annotation)
<summary> Text annotations inside a plot </summary>

--------------------
new : unit -> Annotation
static member Annotation.init : ?X:#System.IConvertible * ?Y:#System.IConvertible * ?Align:StyleParam.AnnotationAlignment * ?ArrowColor:Color * ?ArrowHead:StyleParam.ArrowHead * ?ArrowSide:StyleParam.ArrowSide * ?ArrowSize:float * ?AX:#System.IConvertible * ?AXRef:#System.IConvertible * ?AY:#System.IConvertible * ?AYRef:#System.IConvertible * ?BGColor:Color * ?BorderColor:Color * ?BorderPad:int * ?BorderWidth:int * ?CaptureEvents:bool * ?ClickToShow:StyleParam.ClickToShow * ?Font:Font * ?Height:int * ?HoverLabel:Hoverlabel * ?HoverText:string * ?Name:string * ?Opacity:float * ?ShowArrow:bool * ?StandOff:int * ?StartArrowHead:int * ?StartArrowSize:float * ?StartStandOff:int * ?TemplateItemName:string * ?Text:string * ?TextAngle:float * ?VAlign:StyleParam.VerticalAlign * ?Visible:bool * ?Width:int * ?XAnchor:StyleParam.XAnchorPosition * ?XClick:#System.IConvertible * ?XRef:#System.IConvertible * ?XShift:int * ?YAnchor:StyleParam.YAnchorPosition * ?YClick:#System.IConvertible * ?YRef:#System.IConvertible * ?YShift:int -> Annotation
argument X: float option
<summary> Init Annotation type </summary>
argument Y: float option
<summary> Init Annotation type </summary>
val a2 : Annotation
Multiple items
module Color from Plotly.NET

--------------------
type Color = private new : obj:obj -> Color override Equals : other:obj -> bool override GetHashCode : unit -> int static member fromARGB : a:int -> r:int -> g:int -> b:int -> Color static member fromColorScaleValues : c:seq<#IConvertible> -> Color static member fromColors : c:seq<Color> -> Color static member fromHex : s:string -> Color static member fromKeyword : c:ColorKeyword -> Color static member fromRGB : r:int -> g:int -> b:int -> Color static member fromString : c:string -> Color ...
<summary> Plotly color can be a single color, a sequence of colors, or a sequence of numeric values referencing the color of the colorscale obj </summary>
static member Color.fromString : c:string -> Color
val annotations : GenericChart.GenericChart
type Chart = static member Area : x:seq<#IConvertible> * y:seq<#IConvertible> * ?Name:string * ?ShowMarkers:bool * ?ShowLegend:bool * ?MarkerSymbol:MarkerSymbol * ?Color:Color * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Dash:DrawingStyle * ?Width:float -> GenericChart + 1 overload static member Bar : values:seq<#IConvertible> * ?Keys:seq<#IConvertible> * ?Name:string * ?ShowLegend:bool * ?Color:Color * ?PatternShape:PatternShape * ?MultiPatternShape:seq<PatternShape> * ?Pattern:Pattern * ?Base:#IConvertible * ?Width:'a3 * ?MultiWidth:seq<'a3> * ?Opacity:float * ?MultiOpacity:seq<float> * ?Text:'a4 * ?MultiText:seq<'a4> * ?TextPosition:TextPosition * ?MultiTextPosition:seq<TextPosition> * ?TextFont:Font * ?Marker:Marker -> GenericChart (requires 'a3 :> IConvertible and 'a4 :> IConvertible) + 1 overload static member BoxPlot : ?x:'a0 * ?y:'a1 * ?Name:string * ?ShowLegend:bool * ?Color:Color * ?Fillcolor:Color * ?Opacity:float * ?Whiskerwidth:'a2 * ?Boxpoints:Boxpoints * ?Boxmean:BoxMean * ?Jitter:'a3 * ?Pointpos:'a4 * ?Orientation:Orientation * ?Marker:Marker * ?Line:Line * ?Alignmentgroup:'a5 * ?Offsetgroup:'a6 * ?Notched:bool * ?NotchWidth:float * ?QuartileMethod:QuartileMethod -> GenericChart + 1 overload static member Bubble : x:seq<#IConvertible> * y:seq<#IConvertible> * sizes:seq<int> * ?Name:string * ?ShowLegend:bool * ?MarkerSymbol:MarkerSymbol * ?Color:Color * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?StackGroup:string * ?Orientation:Orientation * ?GroupNorm:GroupNorm * ?UseWebGL:bool -> GenericChart + 1 overload static member Candlestick : open:seq<#IConvertible> * high:seq<#IConvertible> * low:seq<#IConvertible> * close:seq<#IConvertible> * x:seq<#IConvertible> * ?Increasing:Line * ?Decreasing:Line * ?WhiskerWidth:float * ?Line:Line * ?XCalendar:Calendar -> GenericChart + 1 overload static member Column : values:seq<#IConvertible> * ?Keys:seq<#IConvertible> * ?Name:string * ?ShowLegend:bool * ?Color:Color * ?Pattern:Pattern * ?PatternShape:PatternShape * ?MultiPatternShape:seq<PatternShape> * ?Base:#IConvertible * ?Width:'a3 * ?MultiWidth:seq<'a3> * ?Opacity:float * ?MultiOpacity:seq<float> * ?Text:'a4 * ?MultiText:seq<'a4> * ?TextPosition:TextPosition * ?MultiTextPosition:seq<TextPosition> * ?TextFont:Font * ?Marker:Marker -> GenericChart (requires 'a3 :> IConvertible and 'a4 :> IConvertible) + 1 overload static member Contour : data:seq<#seq<'a1>> * ?X:seq<#IConvertible> * ?Y:seq<#IConvertible> * ?Name:string * ?ShowLegend:bool * ?Opacity:float * ?Colorscale:Colorscale * ?Showscale:'a4 * ?zSmooth:SmoothAlg * ?ColorBar:'a5 -> GenericChart (requires 'a1 :> IConvertible) static member Funnel : x:seq<#IConvertible> * y:seq<#IConvertible> * ?Name:string * ?ShowLegend:bool * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Color:Color * ?Line:Line * ?x0:'a3 * ?dX:float * ?y0:'a4 * ?dY:float * ?Width:float * ?Offset:float * ?Orientation:Orientation * ?Alignmentgroup:string * ?Offsetgroup:string * ?Cliponaxis:bool * ?Connector:FunnelConnector * ?Insidetextfont:Font * ?Outsidetextfont:Font -> GenericChart static member Heatmap : data:seq<#seq<'a1>> * ?ColNames:seq<#IConvertible> * ?RowNames:seq<#IConvertible> * ?Name:string * ?ShowLegend:bool * ?Opacity:float * ?Colorscale:Colorscale * ?Showscale:'a4 * ?Xgap:'a5 * ?Ygap:'a6 * ?zSmooth:SmoothAlg * ?ColorBar:'a7 * ?UseWebGL:bool -> GenericChart (requires 'a1 :> IConvertible) static member Histogram : data:seq<#IConvertible> * ?Orientation:Orientation * ?Name:string * ?ShowLegend:bool * ?Opacity:float * ?Color:Color * ?HistNorm:HistNorm * ?HistFunc:HistFunc * ?nBinsx:int * ?nBinsy:int * ?Xbins:Bins * ?Ybins:Bins * ?xError:'a1 * ?yError:'a2 -> GenericChart ...
static member Chart.Line : xy:seq<#System.IConvertible * #System.IConvertible> * ?Name:string * ?ShowMarkers:bool * ?ShowLegend:bool * ?MarkerSymbol:StyleParam.MarkerSymbol * ?Color:Color * ?Opacity:float * ?Labels:seq<#System.IConvertible> * ?TextPosition:StyleParam.TextPosition * ?TextFont:Font * ?Dash:StyleParam.DrawingStyle * ?Width:float * ?StackGroup:string * ?Orientation:StyleParam.Orientation * ?GroupNorm:StyleParam.GroupNorm * ?UseWebGL:bool -> GenericChart.GenericChart
static member Chart.Line : x:seq<#System.IConvertible> * y:seq<#System.IConvertible> * ?Name:string * ?ShowMarkers:bool * ?ShowLegend:bool * ?MarkerSymbol:StyleParam.MarkerSymbol * ?Color:Color * ?Opacity:float * ?Labels:seq<#System.IConvertible> * ?TextPosition:StyleParam.TextPosition * ?TextFont:Font * ?Dash:StyleParam.DrawingStyle * ?Width:float * ?StackGroup:string * ?Orientation:StyleParam.Orientation * ?GroupNorm:StyleParam.GroupNorm * ?UseWebGL:bool -> GenericChart.GenericChart
static member Chart.withAnnotations : annotations:seq<Annotation> * ?Append:bool -> (GenericChart.GenericChart -> GenericChart.GenericChart)
module GenericChart from Plotly.NET
<summary> Module to represent a GenericChart </summary>
val toChartHTML : gChart:GenericChart.GenericChart -> string
<summary> Converts a GenericChart to it HTML representation. The div layer has a default size of 600 if not specified otherwise. </summary>