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.

Attention: Adding an annotation after you added a previous one currently removes the old one. This is a bug and will be fixed

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="white",BorderColor="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
val a1 : Annotation
Multiple items
type Annotation = inherit DynamicObj new : unit -> Annotation static member init : X:IConvertible * Y:IConvertible * ?XRef:IConvertible * ?YRef:IConvertible * ?ArrowTailX:float * ?ArrowTailY:float * ?ShowArrow:bool * ?ArrowColor:string * ?ArrowHead:ArrowHead * ?ArrowSize:float * ?ArrowWidth:float * ?Z:float * ?Text:string * ?TextAngle:float * ?Font:Font * ?Width:float * ?Height:float * ?Opacity:float * ?HorizontalAlign:HorizontalAlign * ?VerticalAlign:VerticalAlign * ?BGColor:string * ?BorderColor:string * ?Visible:bool -> Annotation static member style : X:IConvertible * Y:IConvertible * ?XRef:IConvertible * ?YRef:IConvertible * ?ArrowTailX:float * ?ArrowTailY:float * ?ShowArrow:bool * ?ArrowColor:string * ?ArrowHead:ArrowHead * ?ArrowSize:float * ?ArrowWidth:float * ?Z:float * ?Text:string * ?TextAngle:float * ?Font:Font * ?Width:float * ?Height:float * ?Opacity:float * ?HorizontalAlign:HorizontalAlign * ?VerticalAlign:VerticalAlign * ?BGColor:string * ?BorderColor:string * ?Visible:bool -> (Annotation -> Annotation)
<summary> Text annotations inside a plot </summary>

--------------------
new : unit -> Annotation
static member Annotation.init : X:System.IConvertible * Y:System.IConvertible * ?XRef:System.IConvertible * ?YRef:System.IConvertible * ?ArrowTailX:float * ?ArrowTailY:float * ?ShowArrow:bool * ?ArrowColor:string * ?ArrowHead:StyleParam.ArrowHead * ?ArrowSize:float * ?ArrowWidth:float * ?Z:float * ?Text:string * ?TextAngle:float * ?Font:Font * ?Width:float * ?Height:float * ?Opacity:float * ?HorizontalAlign:StyleParam.HorizontalAlign * ?VerticalAlign:StyleParam.VerticalAlign * ?BGColor:string * ?BorderColor:string * ?Visible:bool -> Annotation
argument X: System.IConvertible
<summary> Init Annotation type </summary>
argument Y: System.IConvertible
<summary> Init Annotation type </summary>
val a2 : Annotation
val annotations : GenericChart.GenericChart
type Chart = static member Area : x:seq<#IConvertible> * y:seq<#IConvertible> * ?Name:string * ?ShowMarkers:bool * ?Showlegend:bool * ?MarkerSymbol:Symbol * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Dash:DrawingStyle * ?Width:float -> GenericChart + 1 overload static member Bar : keys:seq<#IConvertible> * values:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Marker:Marker -> GenericChart + 1 overload static member BarPolar : r:seq<#IConvertible> * theta:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?Dash:DrawingStyle * ?LineWidth:float -> GenericChart static member BoxPlot : ?x:'a0 * ?y:'a1 * ?Name:string * ?Showlegend:bool * ?Color:string * ?Fillcolor:'a2 * ?Opacity:float * ?Whiskerwidth:'a3 * ?Boxpoints:Boxpoints * ?Boxmean:BoxMean * ?Jitter:'a4 * ?Pointpos:'a5 * ?Orientation:Orientation * ?Marker:Marker * ?Line:Line * ?Alignmentgroup:'a6 * ?Offsetgroup:'a7 * ?Notched:bool * ?NotchWidth:float * ?QuartileMethod:QuartileMethod -> GenericChart + 1 overload static member Bubble : x:seq<#IConvertible> * y:seq<#IConvertible> * sizes:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?MarkerSymbol:Symbol * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?StackGroup:string * ?Orientation:Orientation * ?GroupNorm:GroupNorm * ?UseWebGL:bool -> GenericChart + 1 overload static member Bubble3d : x:seq<#IConvertible> * y:seq<#IConvertible> * z:seq<#IConvertible> * sizes:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?MarkerSymbol:Symbol * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font -> GenericChart + 1 overload static member BubblePolar : r:seq<#IConvertible> * theta:seq<#IConvertible> * sizes:seq<#IConvertible> * ?Name:string * ?Showlegend:bool * ?MarkerSymbol:Symbol * ?Color:string * ?Opacity:float * ?Labels:seq<#IConvertible> * ?TextPosition:TextPosition * ?TextFont:Font * ?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 ChoroplethMap : locations:seq<string> * z:seq<#IConvertible> * ?Text:seq<#IConvertible> * ?Locationmode:LocationFormat * ?Autocolorscale:bool * ?Colorscale:Colorscale * ?ColorBar:ColorBar * ?Marker:Marker * ?GeoJson:'a2 * ?FeatureIdKey:string * ?Zmin:float * ?Zmax:float -> GenericChart static member ChoroplethMapbox : locations:seq<#IConvertible> * z:seq<#IConvertible> * geoJson:'a2 * ?FeatureIdKey:string * ?Text:seq<#IConvertible> * ?Below:string * ?Colorscale:Colorscale * ?ColorBar:ColorBar * ?ZAuto:bool * ?ZMin:float * ?ZMid:float * ?ZMax:float -> GenericChart ...
<summary> Provides a set of static methods for creating charts. </summary>
static member Chart.Line : xy:seq<#System.IConvertible * #System.IConvertible> * ?Name:string * ?ShowMarkers:bool * ?Showlegend:bool * ?MarkerSymbol:StyleParam.Symbol * ?Color:string * ?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.Symbol * ?Color:string * ?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> -> (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>