
Summary: This example shows how to create indicator charts in F#.
Indicator Charts visualize the evolution of a value compared to a reference value, optionally inside a range.
There are different types of indicator charts, depending on the IndicatorMode
used in chart generation:
Delta
/Number
(and combinations) simply shows if the value is increasing or decreasing compared to the reference
- Any combination of the above with
Gauge
adds a customizable gauge that indicates where the value lies inside a given range.
open Plotly.NET
open Plotly.NET.TraceObjects
open Plotly.NET.LayoutObjects
let allIndicatorTypes =
[ Chart.Indicator(
value = 120.,
mode = StyleParam.IndicatorMode.NumberDeltaGauge,
Title = "Bullet gauge",
DeltaReference = 90.,
Range = StyleParam.Range.MinMax(-200., 200.),
GaugeShape = StyleParam.IndicatorGaugeShape.Bullet,
ShowGaugeAxis = false,
Domain = Domain.init (Row = 0, Column = 0)
)
Chart.Indicator(
value = 200.,
mode = StyleParam.IndicatorMode.NumberDeltaGauge,
Title = "Angular gauge",
Delta = IndicatorDelta.init (Reference = 160),
Range = StyleParam.Range.MinMax(0., 250.),
Domain = Domain.init (Row = 0, Column = 1)
)
Chart.Indicator(
value = 300.,
mode = StyleParam.IndicatorMode.NumberDelta,
Title = "number and delta",
DeltaReference = 90.,
Domain = Domain.init (Row = 1, Column = 0)
)
Chart.Indicator(
value = 40.,
mode = StyleParam.IndicatorMode.Delta,
Title = "delta",
DeltaReference = 90.,
Domain = Domain.init (Row = 1, Column = 1)
) ]
|> Chart.combine
|> Chart.withLayoutGridStyle (Rows = 2, Columns = 2)
|> Chart.withMarginSize (Left = 200)
namespace Plotly
namespace Plotly.NET
module Defaults
from Plotly.NET
<summary>
Contains mutable global default values.
Changing these values will apply the default values to all consecutive Chart generations.
</summary>
val mutable DefaultDisplayOptions: DisplayOptions
Multiple items
type DisplayOptions =
inherit DynamicObj
new: unit -> DisplayOptions
static member addAdditionalHeadTags: additionalHeadTags: XmlNode list -> (DisplayOptions -> DisplayOptions)
static member addDescription: description: XmlNode list -> (DisplayOptions -> DisplayOptions)
static member combine: first: DisplayOptions -> second: DisplayOptions -> DisplayOptions
static member getAdditionalHeadTags: displayOpts: DisplayOptions -> XmlNode list
static member getDescription: displayOpts: DisplayOptions -> XmlNode list
static member getPlotlyReference: displayOpts: DisplayOptions -> PlotlyJSReference
static member init: ?AdditionalHeadTags: XmlNode list * ?Description: XmlNode list * ?PlotlyJSReference: PlotlyJSReference -> DisplayOptions
static member initCDNOnly: unit -> DisplayOptions
...
--------------------
new: unit -> DisplayOptions
static member DisplayOptions.init: ?AdditionalHeadTags: Giraffe.ViewEngine.HtmlElements.XmlNode list * ?Description: Giraffe.ViewEngine.HtmlElements.XmlNode list * ?PlotlyJSReference: PlotlyJSReference -> DisplayOptions
type PlotlyJSReference =
| CDN of string
| Full
| Require of string
| NoReference
<summary>
Sets how plotly is referenced in the head of html docs.
</summary>
union case PlotlyJSReference.NoReference: PlotlyJSReference
namespace Plotly.NET.TraceObjects
namespace Plotly.NET.LayoutObjects
val allIndicatorTypes: GenericChart.GenericChart
type Chart =
static member AnnotatedHeatmap: zData: seq<#seq<'a1>> * annotationText: seq<#seq<string>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?X: seq<'a3> * ?MultiX: seq<seq<'a3>> * ?XGap: int * ?Y: seq<'a4> * ?MultiY: seq<seq<'a4>> * ?YGap: int * ?Text: 'a5 * ?MultiText: seq<'a5> * ?ColorBar: ColorBar * ?ColorScale: Colorscale * ?ShowScale: bool * ?ReverseScale: bool * ?ZSmooth: SmoothAlg * ?Transpose: bool * ?UseWebGL: bool * ?ReverseYAxis: bool * ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a3 :> IConvertible and 'a4 :> IConvertible and 'a5 :> IConvertible) + 1 overload
static member Area: x: seq<#IConvertible> * y: seq<#IConvertible> * ?ShowMarkers: bool * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'a2 * ?MultiText: seq<'a2> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?MarkerColor: Color * ?MarkerColorScale: Colorscale * ?MarkerOutline: Line * ?MarkerSymbol: MarkerSymbol * ?MultiMarkerSymbol: seq<MarkerSymbol> * ?Marker: Marker * ?LineColor: Color * ?LineColorScale: Colorscale * ?LineWidth: float * ?LineDash: DrawingStyle * ?Line: Line * ?AlignmentGroup: string * ?OffsetGroup: string * ?StackGroup: string * ?Orientation: Orientation * ?GroupNorm: GroupNorm * ?FillColor: Color * ?FillPatternShape: PatternShape * ?FillPattern: Pattern * ?UseWebGL: bool * ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible) + 1 overload
static member Bar: values: seq<#IConvertible> * ?Keys: seq<'a1> * ?MultiKeys: seq<seq<'a1>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'a2 * ?MultiText: seq<'a2> * ?MarkerColor: Color * ?MarkerColorScale: Colorscale * ?MarkerOutline: Line * ?MarkerPatternShape: PatternShape * ?MultiMarkerPatternShape: seq<PatternShape> * ?MarkerPattern: Pattern * ?Marker: Marker * ?Base: #IConvertible * ?Width: 'a4 * ?MultiWidth: seq<'a4> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a2 :> IConvertible and 'a4 :> IConvertible) + 1 overload
static member BoxPlot: ?X: seq<'a0> * ?MultiX: seq<seq<'a0>> * ?Y: seq<'a1> * ?MultiY: seq<seq<'a1>> * ?Name: string * ?ShowLegend: bool * ?Text: 'a2 * ?MultiText: seq<'a2> * ?FillColor: Color * ?MarkerColor: Color * ?Marker: Marker * ?Opacity: float * ?WhiskerWidth: float * ?BoxPoints: BoxPoints * ?BoxMean: BoxMean * ?Jitter: float * ?PointPos: float * ?Orientation: Orientation * ?OutlineColor: Color * ?OutlineWidth: float * ?Outline: Line * ?AlignmentGroup: string * ?OffsetGroup: string * ?Notched: bool * ?NotchWidth: float * ?QuartileMethod: QuartileMethod * ?UseDefaults: bool -> GenericChart (requires 'a0 :> IConvertible and 'a1 :> IConvertible and 'a2 :> IConvertible) + 2 overloads
static member Bubble: x: seq<#IConvertible> * y: seq<#IConvertible> * sizes: seq<int> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'a2 * ?MultiText: seq<'a2> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?MarkerColor: Color * ?MarkerColorScale: Colorscale * ?MarkerOutline: Line * ?MarkerSymbol: MarkerSymbol * ?MultiMarkerSymbol: seq<MarkerSymbol> * ?Marker: Marker * ?LineColor: Color * ?LineColorScale: Colorscale * ?LineWidth: float * ?LineDash: DrawingStyle * ?Line: Line * ?AlignmentGroup: string * ?OffsetGroup: string * ?StackGroup: string * ?Orientation: Orientation * ?GroupNorm: GroupNorm * ?UseWebGL: bool * ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible) + 1 overload
static member Candlestick: ``open`` : seq<#IConvertible> * high: seq<#IConvertible> * low: seq<#IConvertible> * close: seq<#IConvertible> * ?X: seq<'a4> * ?MultiX: seq<seq<'a4>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?Text: 'a5 * ?MultiText: seq<'a5> * ?Line: Line * ?IncreasingColor: Color * ?Increasing: FinanceMarker * ?DecreasingColor: Color * ?Decreasing: FinanceMarker * ?WhiskerWidth: float * ?ShowXAxisRangeSlider: bool * ?UseDefaults: bool -> GenericChart (requires 'a4 :> IConvertible and 'a5 :> IConvertible) + 2 overloads
static member Column: values: seq<#IConvertible> * ?Keys: seq<'a1> * ?MultiKeys: seq<seq<'a1>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?MultiOpacity: seq<float> * ?Text: 'a2 * ?MultiText: seq<'a2> * ?MarkerColor: Color * ?MarkerColorScale: Colorscale * ?MarkerOutline: Line * ?MarkerPatternShape: PatternShape * ?MultiMarkerPatternShape: seq<PatternShape> * ?MarkerPattern: Pattern * ?Marker: Marker * ?Base: #IConvertible * ?Width: 'a4 * ?MultiWidth: seq<'a4> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a2 :> IConvertible and 'a4 :> IConvertible) + 1 overload
static member Contour: zData: seq<#seq<'a1>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?X: seq<'a2> * ?MultiX: seq<seq<'a2>> * ?Y: seq<'a3> * ?MultiY: seq<seq<'a3>> * ?Text: 'a4 * ?MultiText: seq<'a4> * ?ColorBar: ColorBar * ?ColorScale: Colorscale * ?ShowScale: bool * ?ReverseScale: bool * ?Transpose: bool * ?ContourLineColor: Color * ?ContourLineDash: DrawingStyle * ?ContourLineSmoothing: float * ?ContourLine: Line * ?ContoursColoring: ContourColoring * ?ContoursOperation: ConstraintOperation * ?ContoursType: ContourType * ?ShowContourLabels: bool * ?ContourLabelFont: Font * ?Contours: Contours * ?FillColor: Color * ?NContours: int * ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a2 :> IConvertible and 'a3 :> IConvertible and 'a4 :> IConvertible)
static member Funnel: x: seq<#IConvertible> * y: seq<#IConvertible> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?Width: float * ?Offset: float * ?Text: 'a2 * ?MultiText: seq<'a2> * ?TextPosition: TextPosition * ?MultiTextPosition: seq<TextPosition> * ?Orientation: Orientation * ?AlignmentGroup: string * ?OffsetGroup: string * ?MarkerColor: Color * ?MarkerOutline: Line * ?Marker: Marker * ?TextInfo: TextInfo * ?ConnectorLineColor: Color * ?ConnectorLineStyle: DrawingStyle * ?ConnectorFillColor: Color * ?ConnectorLine: Line * ?Connector: FunnelConnector * ?InsideTextFont: Font * ?OutsideTextFont: Font * ?UseDefaults: bool -> GenericChart (requires 'a2 :> IConvertible)
static member Heatmap: zData: seq<#seq<'a1>> * ?X: seq<'a2> * ?MultiX: seq<seq<'a2>> * ?Y: seq<'a3> * ?MultiY: seq<seq<'a3>> * ?Name: string * ?ShowLegend: bool * ?Opacity: float * ?XGap: int * ?YGap: int * ?Text: 'a4 * ?MultiText: seq<'a4> * ?ColorBar: ColorBar * ?ColorScale: Colorscale * ?ShowScale: bool * ?ReverseScale: bool * ?ZSmooth: SmoothAlg * ?Transpose: bool * ?UseWebGL: bool * ?ReverseYAxis: bool * ?UseDefaults: bool -> GenericChart (requires 'a1 :> IConvertible and 'a2 :> IConvertible and 'a3 :> IConvertible and 'a4 :> IConvertible) + 1 overload
...
static member Chart.Indicator: value: System.IConvertible * mode: StyleParam.IndicatorMode * ?Range: StyleParam.Range * ?Name: string * ?Title: string * ?Domain: Domain * ?Align: StyleParam.IndicatorAlignment * ?DeltaReference: #System.IConvertible * ?Delta: IndicatorDelta * ?Number: IndicatorNumber * ?GaugeShape: StyleParam.IndicatorGaugeShape * ?Gauge: IndicatorGauge * ?ShowGaugeAxis: bool * ?GaugeAxis: LinearAxis * ?UseDefaults: bool -> GenericChart.GenericChart
module StyleParam
from Plotly.NET
type IndicatorMode =
| Number
| Delta
| Gauge
| NumberDelta
| NumberGauge
| DeltaGauge
| NumberDeltaGauge
member Convert: unit -> obj
override ToString: unit -> string
static member convert: (IndicatorMode -> obj)
static member toString: (IndicatorMode -> string)
union case StyleParam.IndicatorMode.NumberDeltaGauge: StyleParam.IndicatorMode
Multiple items
type Title =
inherit DynamicObj
new: unit -> Title
static member init: ?Text: string * ?AutoMargin: bool * ?Font: Font * ?Standoff: int * ?Side: Side * ?X: float * ?XAnchor: XAnchorPosition * ?XRef: string * ?Y: float * ?YAnchor: YAnchorPosition * ?YRef: string -> Title
static member style: ?Text: string * ?AutoMargin: bool * ?Font: Font * ?Standoff: int * ?Side: Side * ?X: float * ?XAnchor: XAnchorPosition * ?XRef: string * ?Y: float * ?YAnchor: YAnchorPosition * ?YRef: string -> (Title -> Title)
--------------------
new: unit -> Title
type Range =
| MinMax of IConvertible * IConvertible
| Values of IConvertible array
member Convert: unit -> obj
static member ofMinMax: min: #IConvertible * max: #IConvertible -> Range
static member ofValues: values: seq<#IConvertible> -> Range
static member convert: (Range -> obj)
<summary>
Defines a Range between min and max value
</summary>
union case StyleParam.Range.MinMax: System.IConvertible * System.IConvertible -> StyleParam.Range
type IndicatorGaugeShape =
| Angular
| Bullet
member Convert: unit -> obj
override ToString: unit -> string
static member convert: (IndicatorGaugeShape -> obj)
static member toString: (IndicatorGaugeShape -> string)
union case StyleParam.IndicatorGaugeShape.Bullet: StyleParam.IndicatorGaugeShape
Multiple items
type Domain =
inherit DynamicObj
new: unit -> Domain
static member init: ?X: Range * ?Y: Range * ?Row: int * ?Column: int -> Domain
static member style: ?X: Range * ?Y: Range * ?Row: int * ?Column: int -> (Domain -> Domain)
<summary>
Dimensions type inherits from dynamic object
</summary>
--------------------
new: unit -> Domain
static member Domain.init: ?X: StyleParam.Range * ?Y: StyleParam.Range * ?Row: int * ?Column: int -> Domain
Multiple items
type IndicatorDelta =
inherit DynamicObj
new: unit -> IndicatorDelta
static member init: ?Decreasing: IndicatorSymbol * ?Font: Font * ?Increasing: IndicatorSymbol * ?Position: IndicatorDeltaPosition * ?Prefix: string * ?Reference: #IConvertible * ?Relative: bool * ?Suffix: string * ?ValueFormat: string -> IndicatorDelta
static member style: ?Decreasing: IndicatorSymbol * ?Font: Font * ?Increasing: IndicatorSymbol * ?Position: IndicatorDeltaPosition * ?Prefix: string * ?Reference: #IConvertible * ?Relative: bool * ?Suffix: string * ?ValueFormat: string -> (IndicatorDelta -> IndicatorDelta)
--------------------
new: unit -> IndicatorDelta
static member IndicatorDelta.init: ?Decreasing: IndicatorSymbol * ?Font: Font * ?Increasing: IndicatorSymbol * ?Position: StyleParam.IndicatorDeltaPosition * ?Prefix: string * ?Reference: #System.IConvertible * ?Relative: bool * ?Suffix: string * ?ValueFormat: string -> IndicatorDelta
union case StyleParam.IndicatorMode.NumberDelta: StyleParam.IndicatorMode
union case StyleParam.IndicatorMode.Delta: StyleParam.IndicatorMode
static member Chart.combine: gCharts: seq<GenericChart.GenericChart> -> GenericChart.GenericChart
static member Chart.withLayoutGridStyle: ?SubPlots: (StyleParam.LinearAxisId * StyleParam.LinearAxisId)[][] * ?XAxes: StyleParam.LinearAxisId[] * ?YAxes: StyleParam.LinearAxisId[] * ?Rows: int * ?Columns: int * ?RowOrder: StyleParam.LayoutGridRowOrder * ?Pattern: StyleParam.LayoutGridPattern * ?XGap: float * ?YGap: float * ?Domain: Domain * ?XSide: StyleParam.LayoutGridXSide * ?YSide: StyleParam.LayoutGridYSide -> (GenericChart.GenericChart -> GenericChart.GenericChart)
static member Chart.withMarginSize: ?Left: 'a * ?Right: 'b * ?Top: 'c * ?Bottom: 'd * ?Pad: 'e * ?Autoexpand: 'f -> (GenericChart.GenericChart -> GenericChart.GenericChart)
module GenericChart
from Plotly.NET
<summary>
Module to represent a GenericChart
</summary>
val toChartHTML: gChart: GenericChart.GenericChart -> string