From 986a31377aa35941b6b5a79d7cbb9a217cd17efe Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Thu, 18 Nov 2021 14:06:38 +0100 Subject: [PATCH 1/8] Improve all 3D Charts derived from Scatter3D --- src/Plotly.NET/ChartAPI/Chart3D.fs | 539 ++++++++++++------ .../CommonAbstractions/StyleParams.fs | 26 + src/Plotly.NET/Playground.fsx | 10 + src/Plotly.NET/Templates/ChartTemplates.fs | 4 +- .../Traces/ObjectAbstractions/Marker.fs | 5 +- src/Plotly.NET/Traces/Trace3D.fs | 106 ++-- .../APITest/Chart3DAPITest.cs | 2 +- .../Plotly.NET.Tests.FSharpConsole/Program.fs | 2 +- .../HtmlCodegen/ChartLayout.fs | 9 +- .../Plotly.NET.Tests/HtmlCodegen/Charts3D.fs | 21 +- tests/Plotly.NET.Tests/Traces/TraceID.fs | 2 +- 11 files changed, 483 insertions(+), 243 deletions(-) diff --git a/src/Plotly.NET/ChartAPI/Chart3D.fs b/src/Plotly.NET/ChartAPI/Chart3D.fs index ade0ef311..ae115f4af 100644 --- a/src/Plotly.NET/ChartAPI/Chart3D.fs +++ b/src/Plotly.NET/ChartAPI/Chart3D.fs @@ -21,265 +21,454 @@ module Chart3D = /// Uses points, line or both depending on the mode to represent 3d-data points [] - static member Scatter3d + static member Scatter3D ( - x, y, z, mode, - [] ?Name, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?Dash, - [] ?Width, - [] ?UseDefaults : bool + x: seq<#IConvertible>, + y: seq<#IConvertible>, + z: seq<#IConvertible>, + mode: StyleParam.Mode, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?LineColor : Color, + [] ?LineColorScale : StyleParam.Colorscale, + [] ?LineWidth : float, + [] ?LineDash : StyleParam.DrawingStyle, + [] ?Line : Line, + [] ?Projection : Projection, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true - - Trace3D.initScatter3d (Trace3DStyle.Scatter3d(X = x,Y = y,Z=z, Mode=mode) ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> TraceStyle.Line(?Color=Color,?Dash=Dash,?Width=Width) - |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) - |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) + + let marker = + Marker + |> Option.defaultValue (TraceObjects.Marker.init()) + |> TraceObjects.Marker.style( + ?Color = MarkerColor, + ?Outline = MarkerOutline, + ?Symbol3D = MarkerSymbol, + ?MultiSymbol3D = MultiMarkerSymbol, + ?Colorscale = MarkerColorScale + ) + + let line = + Line + |> Option.defaultValue (Plotly.NET.Line.init()) + |> Plotly.NET.Line.style( + ?Color = LineColor, + ?Dash = LineDash, + ?Colorscale = LineColorScale, + ?Width = LineWidth + ) + + Trace3D.initScatter3D( + Trace3DStyle.Scatter3D( + X = x, + Y = y, + Z = z, + Mode = mode, + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition, + ?Projection = Projection , + Marker = marker , + Line = line + ) + ) + |> GenericChart.ofTraceObject useDefaults /// Uses points, line or both depending on the mode to represent 3d-data points [] - static member Scatter3d(xyz, mode, - [] ?Name, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?Dash, - [] ?Width, - [] ?UseDefaults : bool + static member Scatter3D + ( + xyz: seq<#IConvertible * #IConvertible * #IConvertible>, + mode: StyleParam.Mode, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?LineColor : Color, + [] ?LineColorScale : StyleParam.Colorscale, + [] ?LineWidth : float, + [] ?LineDash : StyleParam.DrawingStyle, + [] ?Line : Line, + [] ?Projection : Projection, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true let x,y,z = Seq.unzip3 xyz - Chart.Scatter3d(x, y, z, mode, ?Name=Name,?ShowLegend=ShowLegend,?MarkerSymbol=MarkerSymbol,?Color=Color,?Opacity=Opacity,?Labels=Labels,?TextPosition=TextPosition,?TextFont=TextFont,?Dash=Dash,?Width=Width, ?UseDefaults=UseDefaults) + Chart.Scatter3D( + x, y, z, mode, + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition, + ?MarkerColor = MarkerColor , + ?MarkerColorScale = MarkerColorScale , + ?MarkerOutline = MarkerOutline , + ?MarkerSymbol = MarkerSymbol , + ?MultiMarkerSymbol = MultiMarkerSymbol, + ?Marker = Marker , + ?LineColor = LineColor , + ?LineColorScale = LineColorScale , + ?LineWidth = LineWidth , + ?LineDash = LineDash , + ?Line = Line , + ?Projection = Projection , + ?UseDefaults = UseDefaults + ) /// [] - static member Point3d + static member Point3D ( - x, y, z, - [] ?Name, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?UseDefaults : bool + x: seq<#IConvertible>, + y: seq<#IConvertible>, + z: seq<#IConvertible>, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?Projection : Projection, + [] ?UseDefaults : bool ) = // if text position or font is set, then show labels (not only when hovering) - let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) + let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || MultiTextPosition.IsSome) - Chart.Scatter3d( + Chart.Scatter3D( x = x, y = y, z = z, - mode = changeMode StyleParam.Mode.Markers, - ?Name = Name, - ?ShowLegend = ShowLegend, - ?MarkerSymbol = MarkerSymbol, - ?Color = Color, - ?Opacity = Opacity, - ?Labels = Labels, - ?TextPosition = TextPosition, - ?TextFont = TextFont, - ?UseDefaults = UseDefaults + mode = changeMode StyleParam.Mode.Markers, + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition, + ?MarkerColor = MarkerColor , + ?MarkerColorScale = MarkerColorScale , + ?MarkerOutline = MarkerOutline , + ?MarkerSymbol = MarkerSymbol , + ?MultiMarkerSymbol = MultiMarkerSymbol, + ?Marker = Marker , + ?Projection = Projection , + ?UseDefaults = UseDefaults ) /// [] - static member Point3d + static member Point3D ( - xyz, - [] ?Name, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?UseDefaults : bool + xyz: seq<#IConvertible * #IConvertible * #IConvertible>, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?Projection : Projection, + [] ?UseDefaults : bool ) = let x, y, z = Seq.unzip3 xyz - Chart.Point3d( + Chart.Point3D( x, y, z, - ?Name = Name, - ?ShowLegend = ShowLegend, - ?MarkerSymbol = MarkerSymbol, - ?Color = Color, - ?Opacity = Opacity, - ?Labels = Labels, - ?TextPosition = TextPosition, - ?TextFont = TextFont, - ?UseDefaults = UseDefaults + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition, + ?MarkerColor = MarkerColor , + ?MarkerColorScale = MarkerColorScale , + ?MarkerOutline = MarkerOutline , + ?MarkerSymbol = MarkerSymbol , + ?MultiMarkerSymbol = MultiMarkerSymbol, + ?Marker = Marker , + ?Projection = Projection , + ?UseDefaults = UseDefaults ) /// Uses points, line or both depending on the mode to represent 3d-data points [] - static member Line3d + static member Line3D ( - x, y, z, - [] ?Name, - [] ?ShowMarkers, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?Dash, - [] ?Width, - [] ?UseDefaults : bool + x: seq<#IConvertible>, + y: seq<#IConvertible>, + z: seq<#IConvertible>, + [] ?ShowMarkers : bool, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?LineColor : Color, + [] ?LineColorScale : StyleParam.Colorscale, + [] ?LineWidth : float, + [] ?LineDash : StyleParam.DrawingStyle, + [] ?Line : Line, + [] ?Projection : Projection, + [] ?UseDefaults : bool ) = let changeMode = let isShowMarker = match ShowMarkers with | Some isShow -> isShow | Option.None -> false - StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) + StyleParam.ModeUtils.showText (TextPosition.IsSome || MultiTextPosition.IsSome) >> StyleParam.ModeUtils.showMarker (isShowMarker) - Chart.Scatter3d( + Chart.Scatter3D( x = x, y = y, z = z, mode = changeMode StyleParam.Mode.Lines, - ?Name = Name , - ?ShowLegend = ShowLegend , - ?MarkerSymbol = MarkerSymbol, - ?Color = Color , - ?Opacity = Opacity , - ?Labels = Labels , - ?TextPosition = TextPosition, - ?TextFont = TextFont , - ?Dash = Dash , - ?Width = Width , - ?UseDefaults = UseDefaults + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition, + ?MarkerColor = MarkerColor , + ?MarkerColorScale = MarkerColorScale , + ?MarkerOutline = MarkerOutline , + ?MarkerSymbol = MarkerSymbol , + ?MultiMarkerSymbol = MultiMarkerSymbol, + ?Marker = Marker , + ?LineColor = LineColor , + ?LineColorScale = LineColorScale , + ?LineWidth = LineWidth , + ?LineDash = LineDash , + ?Line = Line , + ?Projection = Projection , + ?UseDefaults = UseDefaults + ) - /// Uses points, line or both depending on the mode to represent 3d-data points + /// Uses points, line or both depending on the mode to represent 3D-data points [] - static member Line3d + static member Line3D ( - xyz, - [] ?Name, - [] ?ShowMarkers, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?Dash, - [] ?Width, - [] ?UseDefaults : bool + xyz: seq<#IConvertible * #IConvertible * #IConvertible>, + [] ?ShowMarkers : bool, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?LineColor : Color, + [] ?LineColorScale : StyleParam.Colorscale, + [] ?LineWidth : float, + [] ?LineDash : StyleParam.DrawingStyle, + [] ?Line : Line, + [] ?Projection : Projection, + [] ?UseDefaults : bool ) = let x, y, z = Seq.unzip3 xyz - Chart.Line3d( + Chart.Line3D( x, y, z, - ?Name = Name , - ?ShowMarkers = ShowMarkers , - ?ShowLegend = ShowLegend , - ?MarkerSymbol = MarkerSymbol, - ?Color = Color , - ?Opacity = Opacity , - ?Labels = Labels , - ?TextPosition = TextPosition, - ?TextFont = TextFont , - ?Dash = Dash , - ?Width = Width , - ?UseDefaults = UseDefaults + ?ShowMarkers = ShowMarkers , + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition, + ?MarkerColor = MarkerColor , + ?MarkerColorScale = MarkerColorScale , + ?MarkerOutline = MarkerOutline , + ?MarkerSymbol = MarkerSymbol , + ?MultiMarkerSymbol = MultiMarkerSymbol, + ?Marker = Marker , + ?LineColor = LineColor , + ?LineColorScale = LineColorScale , + ?LineWidth = LineWidth , + ?LineDash = LineDash , + ?Line = Line , + ?Projection = Projection , + ?UseDefaults = UseDefaults ) /// [] - static member Bubble3d + static member Bubble3D ( - x, y, z, sizes, - [] ?Name, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?UseDefaults : bool + x: seq<#IConvertible>, + y: seq<#IConvertible>, + z: seq<#IConvertible>, + sizes: seq, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?Projection : Projection, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true - let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) + let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || MultiTextPosition.IsSome) - Trace3D.initScatter3d ( - Trace3DStyle.Scatter3d( + let marker = + Marker + |> Option.defaultValue (TraceObjects.Marker.init()) + |> TraceObjects.Marker.style( + ?Color = MarkerColor, + ?Outline = MarkerOutline, + ?Symbol3D = MarkerSymbol, + ?MultiSymbol3D = MultiMarkerSymbol, + ?Colorscale = MarkerColorScale, + MultiSize = sizes + ) + + Trace3D.initScatter3D( + Trace3DStyle.Scatter3D( X = x, - Y = y, + Y = y, Z = z, - Mode=changeMode StyleParam.Mode.Markers + Mode = changeMode StyleParam.Mode.Markers, + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition, + ?Projection = Projection , + Marker = marker ) ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol, MultiSize=sizes) - |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) + |> GenericChart.ofTraceObject useDefaults + + /// [] - static member Bubble3d + static member Bubble3D ( xyz, sizes, - [] ?Name, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?UseDefaults : bool + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?MarkerColor : Color, + [] ?MarkerColorScale : StyleParam.Colorscale, + [] ?MarkerOutline : Line, + [] ?MarkerSymbol : StyleParam.MarkerSymbol3D, + [] ?MultiMarkerSymbol : seq, + [] ?Marker : Marker, + [] ?Projection : Projection, + [] ?UseDefaults : bool ) = let x, y, z = Seq.unzip3 xyz - Chart.Bubble3d( + Chart.Bubble3D( x, y, z, sizes, - ?Name = Name, - ?ShowLegend = ShowLegend, - ?MarkerSymbol = MarkerSymbol, - ?Color = Color, - ?Opacity = Opacity, - ?Labels = Labels, - ?TextPosition = TextPosition, - ?TextFont = TextFont, - ?UseDefaults = UseDefaults + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?TextPosition = TextPosition , + ?MultiTextPosition = MultiTextPosition, + ?MarkerColor = MarkerColor , + ?MarkerColorScale = MarkerColorScale , + ?MarkerOutline = MarkerOutline , + ?MarkerSymbol = MarkerSymbol , + ?MultiMarkerSymbol = MultiMarkerSymbol, + ?Marker = Marker , + ?Projection = Projection , + ?UseDefaults = UseDefaults + ) - /// Uses points, line or both depending on the mode to represent 3d-data points + /// Uses points, line or both depending on the mode to represent 3D-data points [] static member Surface ( @@ -313,9 +502,9 @@ module Chart3D = |> GenericChart.ofTraceObject useDefaults - /// Uses points, line or both depending on the mode to represent 3d-data points + /// Uses points, line or both depending on the mode to represent 3D-data points [] - static member Mesh3d + static member Mesh3D ( x, y, z, [] ?I, @@ -334,8 +523,8 @@ module Chart3D = let useDefaults = defaultArg UseDefaults true - Trace3D.initMesh3d ( - Trace3DStyle.Mesh3d( + Trace3D.initMesh3D ( + Trace3DStyle.Mesh3D( X = x, Y = y, Z = z, diff --git a/src/Plotly.NET/CommonAbstractions/StyleParams.fs b/src/Plotly.NET/CommonAbstractions/StyleParams.fs index a9e2cc1c4..e0f074202 100644 --- a/src/Plotly.NET/CommonAbstractions/StyleParams.fs +++ b/src/Plotly.NET/CommonAbstractions/StyleParams.fs @@ -2055,6 +2055,32 @@ module StyleParam = override this.ToString() = this |> SymbolStyle.toString member this.Convert() = this |> SymbolStyle.convert + [] + type MarkerSymbol3D = + | Circle + | CircleOpen + | Cross + | Diamond + | DiamondOpen + | Square + | SquareOpen + | X + + static member toString = function + | Circle -> "circle" + | CircleOpen -> "circle-open" + | Cross -> "cross" + | Diamond -> "diamond" + | DiamondOpen -> "diamond-open" + | Square -> "square" + | SquareOpen -> "square-open" + | X -> "x" + + static member convert = MarkerSymbol3D.toString >> box + override this.ToString() = this |> MarkerSymbol3D.toString + member this.Convert() = this |> MarkerSymbol3D.convert + + [] type MarkerSymbol = | Modified of MarkerSymbol * SymbolStyle diff --git a/src/Plotly.NET/Playground.fsx b/src/Plotly.NET/Playground.fsx index 301f99d7c..4cbed7fad 100644 --- a/src/Plotly.NET/Playground.fsx +++ b/src/Plotly.NET/Playground.fsx @@ -183,6 +183,16 @@ open Plotly.NET open FSharp.Data open Deedle +Chart.Bubble3D( + [for i in 0..10 do yield (i,i,i)], + [0 .. 10 .. 100], + MarkerColor = Color.fromColorScaleValues [0..10], + MarkerSymbol = StyleParam.MarkerSymbol3D.Diamond +) + +|> Chart.show + + let data = Http.RequestString @"https://raw.githubusercontent.com/plotly/datasets/master/iris-data.csv" |> fun csv -> Frame.ReadCsvString(csv,true,separators=",") diff --git a/src/Plotly.NET/Templates/ChartTemplates.fs b/src/Plotly.NET/Templates/ChartTemplates.fs index d95ba2b33..d4bf548dc 100644 --- a/src/Plotly.NET/Templates/ChartTemplates.fs +++ b/src/Plotly.NET/Templates/ChartTemplates.fs @@ -504,7 +504,7 @@ module ChartTemplates = ] )) - Trace3D.initMesh3d(Trace3DStyle.Mesh3d( + Trace3D.initMesh3D(Trace3DStyle.Mesh3D( ColorBar = ColorBar.init( OutlineWidth = 0., Ticks = StyleParam.TickOptions.Empty ) @@ -531,7 +531,7 @@ module ChartTemplates = ) )) - Trace3D.initScatter3d(Trace3DStyle.Scatter3d( + Trace3D.initScatter3D(Trace3DStyle.Scatter3D( Line = Line.init( ColorBar = ColorBar.init( OutlineWidth = 0., Ticks = StyleParam.TickOptions.Empty diff --git a/src/Plotly.NET/Traces/ObjectAbstractions/Marker.fs b/src/Plotly.NET/Traces/ObjectAbstractions/Marker.fs index 0f4c5bdbf..972a4aaf5 100644 --- a/src/Plotly.NET/Traces/ObjectAbstractions/Marker.fs +++ b/src/Plotly.NET/Traces/ObjectAbstractions/Marker.fs @@ -95,7 +95,9 @@ type Marker () = [] ?MultiOpacity : seq, [] ?Pattern : Pattern, [] ?Symbol : StyleParam.MarkerSymbol, - [] ?MultiSymbol : seq, + [] ?MultiSymbol : seq, + [] ?Symbol3D : StyleParam.MarkerSymbol3D, + [] ?MultiSymbol3D : seq, [] ?OutlierColor : Color, [] ?OutlierWidth : int, [] ?Maxdisplayed : int, @@ -123,6 +125,7 @@ type Marker () = (Opacity, MultiOpacity) |> DynObj.setSingleOrMultiOpt marker "opacity" Pattern |> DynObj.setValueOpt marker "pattern" (Symbol, MultiSymbol) |> DynObj.setSingleOrMultiOptBy marker "symbol" StyleParam.MarkerSymbol.convert + (Symbol3D, MultiSymbol3D) |> DynObj.setSingleOrMultiOptBy marker "symbol" StyleParam.MarkerSymbol3D.convert OutlierColor |> DynObj.setValueOpt marker "outliercolor" OutlierWidth |> DynObj.setValueOpt marker "outlierwidth" Maxdisplayed |> DynObj.setValueOpt marker "maxdisplayed" diff --git a/src/Plotly.NET/Traces/Trace3D.fs b/src/Plotly.NET/Traces/Trace3D.fs index d87aa0fae..801752879 100644 --- a/src/Plotly.NET/Traces/Trace3D.fs +++ b/src/Plotly.NET/Traces/Trace3D.fs @@ -22,7 +22,7 @@ type Trace3D (traceTypeName) = inherit Trace (traceTypeName) ///initializes a trace of type "scatter3d" applying the givin trace styling function - static member initScatter3d (applyStyle:Trace3D -> Trace3D) = + static member initScatter3D (applyStyle:Trace3D -> Trace3D) = Trace3D("scatter3d") |> applyStyle ///initializes a trace of type "surface" applying the givin trace styling function @@ -30,7 +30,7 @@ type Trace3D (traceTypeName) = Trace3D("surface") |> applyStyle ///initializes a trace of type "mesh3d" applying the givin trace styling function - static member initMesh3d (applyStyle:Trace3D -> Trace3D) = + static member initMesh3D (applyStyle:Trace3D -> Trace3D) = Trace3D("mesh3d") |> applyStyle ///initializes a trace of type "cone" applying the givin trace styling function @@ -84,14 +84,18 @@ type Trace3DStyle() = /// Sets the z coordinates. /// Sets the surface fill color. /// Sets text elements associated with each (x,y,z) triplet. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (x,y,z) coordinates. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels. + /// Sets text elements associated with each (x,y,z) triplet. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (x,y,z) coordinates. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels. /// Sets the positions of the `text` elements with respects to the (x,y) coordinates. + /// Sets the positions of the `text` elements with respects to the (x,y) coordinates. /// Template string used for rendering the information text that appear on points. Note that this will override `textinfo`. Variables are inserted using %{variable}, for example "y: %{y}". Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. Every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. + /// Template string used for rendering the information text that appear on points. Note that this will override `textinfo`. Variables are inserted using %{variable}, for example "y: %{y}". Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. Every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. /// Sets text elements associated with each (x,y,z) triplet. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (x,y,z) coordinates. To be seen, trace `hoverinfo` must contain a "text" flag. + /// Sets text elements associated with each (x,y,z) triplet. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (x,y,z) coordinates. To be seen, trace `hoverinfo` must contain a "text" flag. /// Determines which trace information appear on hover. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired. /// Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>". To hide the secondary box completely, use an empty tag `<extra></extra>`. + /// Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>". To hide the secondary box completely, use an empty tag `<extra></extra>`. /// Sets the hover text formatting rulefor `x` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `xaxis.hoverformat`. /// Sets the hover text formatting rulefor `y` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `yaxis.hoverformat`. - /// Sets the hover text formatting rulefor `z` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `zaxis.hoverformat`. /// Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text` `rangeselector`, `updatemenues` and `sliders` `label` text all support `meta`. To access the trace `meta` values in an attribute in the same trace, simply use `%{meta[i]}` where `i` is the index or key of the `meta` item in question. To access trace `meta` in layout attributes, use `%{data[n[.meta[i]}` where `i` is the index or key of the `meta` and `n` is the trace index. /// Assigns extra data each datum. This may be useful when listening to hover, click and selection events. Note that, "scatter" traces also appends customdata items in the markers DOM elements /// Sets a reference between this trace's 3D coordinate system and a 3D scene. If "scene" (the default value), the (x,y,z) coordinates refer to `layout.scene`. If "scene2", the (x,y,z) coordinates refer to `layout.scene2`, and so on. @@ -101,6 +105,7 @@ type Trace3DStyle() = /// Sets the x Error of this trace. /// Sets the y Error of this trace. /// Sets the z Error of this trace. + /// Sets the hover text formatting rulefor `z` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `zaxis.hoverformat`. /// Determines whether or not gaps (i.e. {nan} or missing values) in the provided data arrays are connected. /// Sets the hoverlabel of this trace. /// Sets the projection of this trace. @@ -109,7 +114,7 @@ type Trace3DStyle() = /// Sets the calendar system to use with `y` date data. /// Sets the calendar system to use with `z` date data. /// Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well as some `editable: true` modifications such as `name` and `colorbar.title`. Defaults to `layout.uirevision`. Note that other user-driven trace attribute changes are controlled by `layout` attributes: `trace.visible` is controlled by `layout.legend.uirevision`, `selectedpoints` is controlled by `layout.selectionrevision`, and `colorbar.(x|y)` (accessible with `config: {editable: true}`) is controlled by `layout.editrevision`. Trace changes are tracked by `uid`, which only falls back on trace index if no `uid` is provided. So if your app can add/remove traces before the end of the `data` array, such that the same trace has a different index, you can still preserve user-driven changes if you give each trace a `uid` that stays with it as it moves. - static member Scatter3d + static member Scatter3D ( [] ?Name : string, [] ?Visible : StyleParam.Visible, @@ -124,15 +129,19 @@ type Trace3DStyle() = [] ?Y : seq<#IConvertible>, [] ?Z : seq<#IConvertible>, [] ?SurfaceColor : Color, - [] ?Text : seq<#IConvertible>, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, [] ?TextTemplate : string, - [] ?HoverText : seq<#IConvertible>, - [] ?HoverInfo : string, + [] ?MultiTextTemplate : seq, + [] ?HoverText : string, + [] ?MultiHoverText : seq, + [] ?HoverInfo : StyleParam.HoverInfo, [] ?HoverTemplate : string, + [] ?MultiHoverTemplate : seq, [] ?XHoverFormat : string, [] ?YHoverFormat : string, - [] ?ZHoverFormat : string, [] ?Meta : string, [] ?CustomData : seq<#IConvertible>, [] ?Scene : StyleParam.SubPlotId, @@ -142,6 +151,7 @@ type Trace3DStyle() = [] ?ErrorX : Error, [] ?ErrorY : Error, [] ?ErrorZ : Error, + [] ?ZHoverFormat : string, [] ?ConnectGaps : bool, [] ?Hoverlabel : Hoverlabel, [] ?Projection : Projection, @@ -154,45 +164,45 @@ type Trace3DStyle() = (fun (scatter: #Trace) -> - Name |> DynObj.setValueOpt scatter "name" - Visible |> DynObj.setValueOptBy scatter "visible" StyleParam.Visible.convert - ShowLegend |> DynObj.setValueOpt scatter "showlegend" - LegendRank |> DynObj.setValueOpt scatter "legendrank" - LegendGroup |> DynObj.setValueOpt scatter "legendgroup" - LegendGroupTitle |> DynObj.setValueOpt scatter "legendgrouptitle" - Mode |> DynObj.setValueOptBy scatter "mode" StyleParam.Mode.convert - Opacity |> DynObj.setValueOpt scatter "opacity" - Ids |> DynObj.setValueOpt scatter "ids" - X |> DynObj.setValueOpt scatter "x" - Y |> DynObj.setValueOpt scatter "y" - Z |> DynObj.setValueOpt scatter "z" - SurfaceColor |> DynObj.setValueOpt scatter "surfacecolor" - Text |> DynObj.setValueOpt scatter "text" - TextPosition |> DynObj.setValueOptBy scatter "textposition" StyleParam.TextPosition.convert - TextTemplate |> DynObj.setValueOpt scatter "texttemplate" - HoverText |> DynObj.setValueOpt scatter "hovertext" - HoverInfo |> DynObj.setValueOpt scatter "hoverinfo" - HoverTemplate |> DynObj.setValueOpt scatter "hovertemplate" - XHoverFormat |> DynObj.setValueOpt scatter "xhoverformat" - YHoverFormat |> DynObj.setValueOpt scatter "yhoverformat" - ZHoverFormat |> DynObj.setValueOpt scatter "zhoverformat" - Meta |> DynObj.setValueOpt scatter "meta" - CustomData |> DynObj.setValueOpt scatter "customdata" - Scene |> DynObj.setValueOptBy scatter "scene" StyleParam.SubPlotId.convert - Marker |> DynObj.setValueOpt scatter "marker" - Line |> DynObj.setValueOpt scatter "line" - TextFont |> DynObj.setValueOpt scatter "textfont" - ErrorX |> DynObj.setValueOpt scatter "errorx" - ErrorY |> DynObj.setValueOpt scatter "errory" - ErrorZ |> DynObj.setValueOpt scatter "errorz" - ConnectGaps |> DynObj.setValueOpt scatter "connectgaps" - Hoverlabel |> DynObj.setValueOpt scatter "hoverlabel" - Projection |> DynObj.setValueOpt scatter "projection" - Surfaceaxis |> DynObj.setValueOptBy scatter "surfaceaxis" StyleParam.SurfaceAxis.convert - XCalendar |> DynObj.setValueOptBy scatter "xcalendar" StyleParam.Calendar.convert - YCalendar |> DynObj.setValueOptBy scatter "ycalendar" StyleParam.Calendar.convert - ZCalendar |> DynObj.setValueOptBy scatter "zcalendar" StyleParam.Calendar.convert - UIRevision |> DynObj.setValueOpt scatter "uirevision" + Name |> DynObj.setValueOpt scatter "name" + Visible |> DynObj.setValueOptBy scatter "visible" StyleParam.Visible.convert + ShowLegend |> DynObj.setValueOpt scatter "showlegend" + LegendRank |> DynObj.setValueOpt scatter "legendrank" + LegendGroup |> DynObj.setValueOpt scatter "legendgroup" + LegendGroupTitle |> DynObj.setValueOpt scatter "legendgrouptitle" + Mode |> DynObj.setValueOptBy scatter "mode" StyleParam.Mode.convert + Opacity |> DynObj.setValueOpt scatter "opacity" + Ids |> DynObj.setValueOpt scatter "ids" + X |> DynObj.setValueOpt scatter "x" + Y |> DynObj.setValueOpt scatter "y" + Z |> DynObj.setValueOpt scatter "z" + SurfaceColor |> DynObj.setValueOpt scatter "surfacecolor" + (Text, MultiText) |> DynObj.setSingleOrMultiOpt scatter "text" + (TextPosition, MultiTextPosition) |> DynObj.setSingleOrMultiOptBy scatter "textposition" StyleParam.TextPosition.convert + (TextTemplate, MultiTextTemplate) |> DynObj.setSingleOrMultiOpt scatter "texttemplate" + (HoverText, MultiHoverText) |> DynObj.setSingleOrMultiOpt scatter "hovertext" + HoverInfo |> DynObj.setValueOptBy scatter "hoverinfo" StyleParam.HoverInfo.convert + (HoverTemplate, MultiHoverTemplate) |> DynObj.setSingleOrMultiOpt scatter "hovertemplate" + XHoverFormat |> DynObj.setValueOpt scatter "xhoverformat" + YHoverFormat |> DynObj.setValueOpt scatter "yhoverformat" + ZHoverFormat |> DynObj.setValueOpt scatter "zhoverformat" + Meta |> DynObj.setValueOpt scatter "meta" + CustomData |> DynObj.setValueOpt scatter "customdata" + Scene |> DynObj.setValueOptBy scatter "scene" StyleParam.SubPlotId.convert + Marker |> DynObj.setValueOpt scatter "marker" + Line |> DynObj.setValueOpt scatter "line" + TextFont |> DynObj.setValueOpt scatter "textfont" + ErrorX |> DynObj.setValueOpt scatter "errorx" + ErrorY |> DynObj.setValueOpt scatter "errory" + ErrorZ |> DynObj.setValueOpt scatter "errorz" + ConnectGaps |> DynObj.setValueOpt scatter "connectgaps" + Hoverlabel |> DynObj.setValueOpt scatter "hoverlabel" + Projection |> DynObj.setValueOpt scatter "projection" + Surfaceaxis |> DynObj.setValueOptBy scatter "surfaceaxis" StyleParam.SurfaceAxis.convert + XCalendar |> DynObj.setValueOptBy scatter "xcalendar" StyleParam.Calendar.convert + YCalendar |> DynObj.setValueOptBy scatter "ycalendar" StyleParam.Calendar.convert + ZCalendar |> DynObj.setValueOptBy scatter "zcalendar" StyleParam.Calendar.convert + UIRevision |> DynObj.setValueOpt scatter "uirevision" scatter ) @@ -394,7 +404,7 @@ type Trace3DStyle() = /// Sets the calendar system to use with `y` date data. /// Sets the calendar system to use with `z` date data. /// Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well as some `editable: true` modifications such as `name` and `colorbar.title`. Defaults to `layout.uirevision`. Note that other user-driven trace attribute changes are controlled by `layout` attributes: `trace.visible` is controlled by `layout.legend.uirevision`, `selectedpoints` is controlled by `layout.selectionrevision`, and `colorbar.(x|y)` (accessible with `config: {editable: true}`) is controlled by `layout.editrevision`. Trace changes are tracked by `uid`, which only falls back on trace index if no `uid` is provided. So if your app can add/remove traces before the end of the `data` array, such that the same trace has a different index, you can still preserve user-driven changes if you give each trace a `uid` that stays with it as it moves. - static member Mesh3d + static member Mesh3D ( [] ?Name : string, [] ?Visible : StyleParam.Visible, diff --git a/tests/Plotly.NET.Tests.CSharp/APITest/Chart3DAPITest.cs b/tests/Plotly.NET.Tests.CSharp/APITest/Chart3DAPITest.cs index 3818f02fd..2c9520982 100644 --- a/tests/Plotly.NET.Tests.CSharp/APITest/Chart3DAPITest.cs +++ b/tests/Plotly.NET.Tests.CSharp/APITest/Chart3DAPITest.cs @@ -15,6 +15,6 @@ public class Chart3DAPITest private static readonly Tuple[] xyz = x.Zip(y).Zip(z).Select(c => new Tuple(c.Item1.First, c.Item1.Second, c.Item2)).ToArray(); [Fact] public void Scatter3d1() - => Chart3D.Chart.Scatter3d(x, y, z, StyleParam.Mode.Lines); + => Chart3D.Chart.Scatter3D(x, y, z, StyleParam.Mode.Lines); } } diff --git a/tests/Plotly.NET.Tests.FSharpConsole/Program.fs b/tests/Plotly.NET.Tests.FSharpConsole/Program.fs index bdd44f062..87695fb5a 100644 --- a/tests/Plotly.NET.Tests.FSharpConsole/Program.fs +++ b/tests/Plotly.NET.Tests.FSharpConsole/Program.fs @@ -18,7 +18,7 @@ let main argv = let y = [19; 26; 55;] let z = [19; 26; 55;] - Chart.Scatter3d(x,y,z,StyleParam.Mode.Markers) + Chart.Scatter3D(x,y,z,StyleParam.Mode.Markers) |> Chart.withXAxisStyle("my x-axis", Id=StyleParam.SubPlotId.Scene 1) |> Chart.withYAxisStyle("my y-axis", Id=StyleParam.SubPlotId.Scene 1) |> Chart.withZAxisStyle("my z-axis") diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs b/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs index fa96717af..00bf2e2f5 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/ChartLayout.fs @@ -163,7 +163,7 @@ let multiTraceGrid = Chart.Point([1,2; 2,3], UseDefaults = false) Chart.PointTernary([1,2,3; 2,3,4], UseDefaults = false) Chart.Heatmap([[1; 2];[3; 4]], ShowScale=false, UseDefaults = false) - Chart.Point3d([1,3,2], UseDefaults = false) + Chart.Point3D([1,3,2], UseDefaults = false) Chart.PointMapbox([1,2], UseDefaults = false) |> Chart.withMapbox(Mapbox.init(Style = StyleParam.MapboxStyle.OpenStreetMap)) [ // you can use nested combined charts, but they have to have the same trace type (Cartesian2D in this case) @@ -182,7 +182,7 @@ let multiTraceSingleStack = Chart.Point([1,2; 2,3], UseDefaults = false) Chart.PointTernary([1,2,3; 2,3,4], UseDefaults = false) Chart.Heatmap([[1; 2];[3; 4]], ShowScale=false, UseDefaults = false) - Chart.Point3d([1,3,2], UseDefaults = false) + Chart.Point3D([1,3,2], UseDefaults = false) Chart.PointMapbox([1,2], UseDefaults = false) |> Chart.withMapbox(Mapbox.init(Style = StyleParam.MapboxStyle.OpenStreetMap)) [ // you can use nested combined charts, but they have to have the same trace type (Cartesian2D in this case) @@ -195,6 +195,7 @@ let multiTraceSingleStack = |> Chart.SingleStack() |> Chart.withSize(1000,1000) + [] let ``Multicharts and subplots`` = testList "ChartLayout.Multicharts and subplots" [ @@ -211,7 +212,7 @@ let ``Multicharts and subplots`` = |> chartGeneratedContains subPlotChart ); testCase "MultiTrace Subplot grid data" ( fun () -> - """var data = [{"type":"scatter","mode":"markers","x":[1,2],"y":[2,3],"marker":{},"xaxis":"x","yaxis":"y"},{"type":"scatterternary","mode":"markers","a":[1,2],"b":[2,3],"c":[3,4],"marker":{},"subplot":"ternary2"},{"type":"heatmap","z":[[1,2],[3,4]],"showscale":false,"xaxis":"x3","yaxis":"y3"},{"type":"scatter3d","mode":"markers","x":[1],"y":[3],"z":[2],"line":{},"marker":{},"scene":"scene4"},{"type":"scattermapbox","mode":"markers","lon":[1],"lat":[2],"line":{},"marker":{},"subplot":"mapbox5"},{"type":"box","x":"y","y":[2.0,1.5,5.0,1.5,2.0,2.5,2.1,2.5,1.5,1.0,2.0,1.5,5.0,1.5,3.0,2.5,2.5,1.5,3.5,1.0],"boxpoints":"all","jitter":0.1,"name":"bin1","marker":{},"xaxis":"x6","yaxis":"y6"},{"type":"box","x":"y'","y":[2.0,1.5,5.0,1.5,2.0,2.5,2.1,2.5,1.5,1.0,2.0,1.5,5.0,1.5,3.0,2.5,2.5,1.5,3.5,1.0],"boxpoints":"all","jitter":0.1,"name":"bin2","marker":{},"xaxis":"x6","yaxis":"y6"}];""" + """var data = [{"type":"scatter","mode":"markers","x":[1,2],"y":[2,3],"marker":{},"xaxis":"x","yaxis":"y"},{"type":"scatterternary","mode":"markers","a":[1,2],"b":[2,3],"c":[3,4],"marker":{},"subplot":"ternary2"},{"type":"heatmap","z":[[1,2],[3,4]],"showscale":false,"xaxis":"x3","yaxis":"y3"},{"type":"scatter3d","mode":"markers","x":[1],"y":[3],"z":[2],"marker":{},"line":{},"scene":"scene4"},{"type":"scattermapbox","mode":"markers","lon":[1],"lat":[2],"line":{},"marker":{},"subplot":"mapbox5"},{"type":"box","x":"y","y":[2.0,1.5,5.0,1.5,2.0,2.5,2.1,2.5,1.5,1.0,2.0,1.5,5.0,1.5,3.0,2.5,2.5,1.5,3.5,1.0],"boxpoints":"all","jitter":0.1,"name":"bin1","marker":{},"xaxis":"x6","yaxis":"y6"},{"type":"box","x":"y'","y":[2.0,1.5,5.0,1.5,2.0,2.5,2.1,2.5,1.5,1.0,2.0,1.5,5.0,1.5,3.0,2.5,2.5,1.5,3.5,1.0],"boxpoints":"all","jitter":0.1,"name":"bin2","marker":{},"xaxis":"x6","yaxis":"y6"}];""" |> chartGeneratedContains multiTraceGrid ); testCase "MultiTrace Subplot grid layout" ( fun () -> @@ -228,7 +229,7 @@ let ``Multicharts and subplots`` = ); testCase "MultiTrace Single Stack data" ( fun () -> - """var data = [{"type":"scatter","mode":"markers","x":[1,2],"y":[2,3],"marker":{},"xaxis":"x","yaxis":"y"},{"type":"scatterternary","mode":"markers","a":[1,2],"b":[2,3],"c":[3,4],"marker":{},"subplot":"ternary2"},{"type":"heatmap","z":[[1,2],[3,4]],"showscale":false,"xaxis":"x3","yaxis":"y3"},{"type":"scatter3d","mode":"markers","x":[1],"y":[3],"z":[2],"line":{},"marker":{},"scene":"scene4"},{"type":"scattermapbox","mode":"markers","lon":[1],"lat":[2],"line":{},"marker":{},"subplot":"mapbox5"},{"type":"box","x":"y","y":[2.0,1.5,5.0,1.5,2.0,2.5,2.1,2.5,1.5,1.0,2.0,1.5,5.0,1.5,3.0,2.5,2.5,1.5,3.5,1.0],"boxpoints":"all","jitter":0.1,"name":"bin1","marker":{},"xaxis":"x6","yaxis":"y6"},{"type":"box","x":"y'","y":[2.0,1.5,5.0,1.5,2.0,2.5,2.1,2.5,1.5,1.0,2.0,1.5,5.0,1.5,3.0,2.5,2.5,1.5,3.5,1.0],"boxpoints":"all","jitter":0.1,"name":"bin2","marker":{},"xaxis":"x6","yaxis":"y6"}];""" + """var data = [{"type":"scatter","mode":"markers","x":[1,2],"y":[2,3],"marker":{},"xaxis":"x","yaxis":"y"},{"type":"scatterternary","mode":"markers","a":[1,2],"b":[2,3],"c":[3,4],"marker":{},"subplot":"ternary2"},{"type":"heatmap","z":[[1,2],[3,4]],"showscale":false,"xaxis":"x3","yaxis":"y3"},{"type":"scatter3d","mode":"markers","x":[1],"y":[3],"z":[2],"marker":{},"line":{},"scene":"scene4"},{"type":"scattermapbox","mode":"markers","lon":[1],"lat":[2],"line":{},"marker":{},"subplot":"mapbox5"},{"type":"box","x":"y","y":[2.0,1.5,5.0,1.5,2.0,2.5,2.1,2.5,1.5,1.0,2.0,1.5,5.0,1.5,3.0,2.5,2.5,1.5,3.5,1.0],"boxpoints":"all","jitter":0.1,"name":"bin1","marker":{},"xaxis":"x6","yaxis":"y6"},{"type":"box","x":"y'","y":[2.0,1.5,5.0,1.5,2.0,2.5,2.1,2.5,1.5,1.0,2.0,1.5,5.0,1.5,3.0,2.5,2.5,1.5,3.5,1.0],"boxpoints":"all","jitter":0.1,"name":"bin2","marker":{},"xaxis":"x6","yaxis":"y6"}];""" |> chartGeneratedContains multiTraceSingleStack ); testCase "MultiTrace Single Stack layout" ( fun () -> diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/Charts3D.fs b/tests/Plotly.NET.Tests/HtmlCodegen/Charts3D.fs index c8be6fe99..362ea1c45 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/Charts3D.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/Charts3D.fs @@ -32,7 +32,7 @@ let scatterChart = let y = [19; 26; 55;] let z = [19; 26; 55;] - Chart.Scatter3d(x,y,z,StyleParam.Mode.Markers, UseDefaults = false) + Chart.Scatter3D(x,y,z,StyleParam.Mode.Markers, UseDefaults = false) |> Chart.withXAxisStyle("my x-axis", Id=StyleParam.SubPlotId.Scene 1) |> Chart.withYAxisStyle("my y-axis", Id=StyleParam.SubPlotId.Scene 1) |> Chart.withZAxisStyle("my z-axis") @@ -42,7 +42,7 @@ let scatterChart = let ``3D Scatter charts`` = testList "Charts3D.3D Scatter charts" [ testCase "3D Scatter charts data" ( fun () -> - """var data = [{"type":"scatter3d","mode":"markers","x":[19,26,55],"y":[19,26,55],"z":[19,26,55],"line":{},"marker":{}}]""" + """var data = [{"type":"scatter3d","mode":"markers","x":[19,26,55],"y":[19,26,55],"z":[19,26,55],"marker":{},"line":{}}];""" |> chartGeneratedContains scatterChart ); testCase "3D Scatter charts layout" ( fun () -> @@ -56,7 +56,7 @@ let pointChart = let y = [19; 26; 55;] let z = [19; 26; 55;] - Chart.Point3d(x,y,z, UseDefaults = false) + Chart.Point3D(x,y,z, UseDefaults = false) |> Chart.withXAxisStyle("my x-axis", Id=StyleParam.SubPlotId.Scene 1) |> Chart.withYAxisStyle("my y-axis", Id=StyleParam.SubPlotId.Scene 1) |> Chart.withZAxisStyle("my z-axis") @@ -66,7 +66,7 @@ let pointChart = let ``3D Point charts`` = testList "Charts3D.3D Point charts" [ testCase "3D Point charts data" ( fun () -> - """var data = [{"type":"scatter3d","mode":"markers","x":[19,26,55],"y":[19,26,55],"z":[19,26,55],"line":{},"marker":{}}]""" + """var data = [{"type":"scatter3d","mode":"markers","x":[19,26,55],"y":[19,26,55],"z":[19,26,55],"marker":{},"line":{}}];""" |> chartGeneratedContains pointChart ); testCase "3D Point charts layout" ( fun () -> @@ -91,7 +91,7 @@ let lineChart = ) |> List.unzip3 - Chart.Line3d(x, y, z, ShowMarkers=true, UseDefaults = false) + Chart.Line3D(x, y, z, ShowMarkers=true, UseDefaults = false) |> Chart.withXAxisStyle("x-axis", Id=StyleParam.SubPlotId.Scene 1) |> Chart.withYAxisStyle("y-axis", Id=StyleParam.SubPlotId.Scene 1) |> Chart.withZAxisStyle("z-axis") @@ -101,7 +101,7 @@ let lineChart = let ``Line charts`` = testList "Charts3D.Line charts" [ testCase "Line data" ( fun () -> - """var data = [{"type":"scatter3d","mode":"lines+markers","x":[10.0,8.765,5.376,0.699,-4.079,-7.762,-9.458,-8.797,-6.02,-1.898,2.489,6.042,7.925,7.774,5.766,2.536,-1.014,-3.973,-5.664,-5.8,-4.534,-2.366,0.02,1.974,3.058,3.146,2.427,1.303,0.232,-0.428,-0.537],"y":[0.0,4.788,8.373,9.863,8.912,5.799,1.348,-3.295,-6.971,-8.802,-8.415,-6.015,-2.306,1.713,5.025,6.863,6.893,5.27,2.562,-0.437,-2.939,-4.377,-4.536,-3.576,-1.944,-0.209,1.124,1.76,1.684,1.127,0.46],"z":[0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0],"line":{},"marker":{}}];""" + """var data = [{"type":"scatter3d","mode":"lines+markers","x":[10.0,8.765,5.376,0.699,-4.079,-7.762,-9.458,-8.797,-6.02,-1.898,2.489,6.042,7.925,7.774,5.766,2.536,-1.014,-3.973,-5.664,-5.8,-4.534,-2.366,0.02,1.974,3.058,3.146,2.427,1.303,0.232,-0.428,-0.537],"y":[0.0,4.788,8.373,9.863,8.912,5.799,1.348,-3.295,-6.971,-8.802,-8.415,-6.015,-2.306,1.713,5.025,6.863,6.893,5.27,2.562,-0.437,-2.939,-4.377,-4.536,-3.576,-1.944,-0.209,1.124,1.76,1.684,1.127,0.46],"z":[0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0],"marker":{},"line":{}}];""" |> chartGeneratedContains lineChart ); testCase "Line layout" ( fun () -> @@ -111,10 +111,10 @@ let ``Line charts`` = ] let bubbleChart = - Chart.Bubble3d( + Chart.Bubble3D( [1,3,2; 6,5,4; 7,9,8], [20; 40; 30], - Labels = ["A"; "B"; "C"], + MultiText = ["A"; "B"; "C"], TextPosition = StyleParam.TextPosition.TopLeft, UseDefaults = false ) @@ -122,11 +122,12 @@ let bubbleChart = |> Chart.withYAxisStyle("y-axis", Id=StyleParam.SubPlotId.Scene 1) |> Chart.withZAxisStyle("z-axis") + [] let ``Bubble charts`` = testList "Charts3D.Bubble charts" [ testCase "Bubble data" ( fun () -> - """var data = [{"type":"scatter3d","mode":"markers+text","x":[1,6,7],"y":[3,5,9],"z":[2,4,8],"marker":{"size":[20,40,30]},"text":["A","B","C"],"textposition":"top left"}];""" + """var data = [{"type":"scatter3d","mode":"markers+text","x":[1,6,7],"y":[3,5,9],"z":[2,4,8],"text":["A","B","C"],"textposition":"top left","marker":{"size":[20,40,30]}}];""" |> chartGeneratedContains bubbleChart ); testCase "Bubble layout" ( fun () -> @@ -209,7 +210,7 @@ let meshChart = let b = Array.init 50 (fun _ -> rnd.NextDouble()) let c = Array.init 50 (fun _ -> rnd.NextDouble()) - Trace3D.initMesh3d + Trace3D.initMesh3D (fun mesh3d -> mesh3d?x <- a mesh3d?y <- b diff --git a/tests/Plotly.NET.Tests/Traces/TraceID.fs b/tests/Plotly.NET.Tests/Traces/TraceID.fs index b8c55f6e7..0391e8bc1 100644 --- a/tests/Plotly.NET.Tests/Traces/TraceID.fs +++ b/tests/Plotly.NET.Tests/Traces/TraceID.fs @@ -9,7 +9,7 @@ open Plotly.NET.GenericChart let allTraceTypesChart = [ Chart.Point([]) - Chart.Point3d([]) + Chart.Point3D([]) Chart.PointPolar([]) Chart.ChoroplethMap([],[]) Chart.ChoroplethMapbox([],[],obj) From bfa98fec336351fb2bc0e472bbffdbb4e79b85c9 Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Thu, 18 Nov 2021 14:13:45 +0100 Subject: [PATCH 2/8] Fix and improve 3D docs --- docs/01_2_multiple-charts.fsx | 2 +- docs/03_0_3d-scatter-plots.fsx | 89 ++++++++++++++++++++++++++++++---- docs/03_2_3d-mesh-plots.fsx | 2 +- 3 files changed, 82 insertions(+), 11 deletions(-) diff --git a/docs/01_2_multiple-charts.fsx b/docs/01_2_multiple-charts.fsx index 191395991..7e9265e6e 100644 --- a/docs/01_2_multiple-charts.fsx +++ b/docs/01_2_multiple-charts.fsx @@ -255,7 +255,7 @@ let multipleTraceTypesGrid = Chart.Point([1,2; 2,3]) Chart.PointTernary([1,2,3; 2,3,4]) Chart.Heatmap([[1; 2];[3; 4]], ShowScale=false) - Chart.Point3d([1,3,2]) + Chart.Point3D([1,3,2]) Chart.PointMapbox([1,2]) |> Chart.withMapbox(Mapbox.init(Style = StyleParam.MapboxStyle.OpenStreetMap)) [ // you can use nested combined charts, but they have to have the same trace type (Cartesian2D in this case) diff --git a/docs/03_0_3d-scatter-plots.fsx b/docs/03_0_3d-scatter-plots.fsx index 0ae0cf22d..036b3a5ed 100644 --- a/docs/03_0_3d-scatter-plots.fsx +++ b/docs/03_0_3d-scatter-plots.fsx @@ -30,15 +30,18 @@ index: 1 *Summary:* This example shows how to create three-dimensional point and line charts in F#. -A Scatter3d chart report shows a three-dimensional spinnable view of your data +Point3D, Line3D, and Bubble3D charts are all derived from `Chart.Scatter3D` and can be generated by that function as well. +However, `Chart.Point3D`, `Chart.Line3D`, or `Chart.Bubble3D` provide sensible defaults and arguments for the respective derived chart, and are recommended to use. + +## 3D point chart *) open Plotly.NET let point3d = - Chart.Point3d( + Chart.Point3D( [1,3,2; 6,5,4; 7,9,8], - Labels = ["A"; "B"; "C"], + MultiText = ["A"; "B"; "C"], TextPosition = StyleParam.TextPosition.BottomCenter ) |> Chart.withXAxisStyle("my x-axis", Id=StyleParam.SubPlotId.Scene 1) // in contrast to 2D plots, x and y axes of 3D charts have to be set via the scene object @@ -55,16 +58,35 @@ point3d point3d |> GenericChart.toChartHTML (*** include-it-raw ***) +(** +## 3D point chart with marker colorscale +*) + +let point3d2 = + Chart.Point3D( + [1,3,2; 6,5,4; 7,9,8], + MarkerColor = Color.fromColorScaleValues [0;1;2], + MultiText = ["A"; "B"; "C"], + TextPosition = StyleParam.TextPosition.BottomCenter + ) +(*** condition: ipynb ***) +#if IPYNB +point3d2 +#endif // IPYNB + +(***hide***) +point3d2 |> GenericChart.toChartHTML +(*** include-it-raw ***) (** -# 3D Line plots +# 3D Line chart *) let line3d = - Chart.Line3d( + Chart.Line3D( [1,3,2; 6,5,4; 7,9,8], - Labels = ["A"; "B"; "C"], + MultiText = ["A"; "B"; "C"], TextPosition = StyleParam.TextPosition.BottomCenter, ShowMarkers = true ) @@ -78,15 +100,39 @@ line3d line3d |> GenericChart.toChartHTML (*** include-it-raw ***) +(** +## 3D line chart with line colorscale +*) + +let line3d2 = + Chart.Line3D( + [1,3,2; 6,5,4; 7,9,8], + MultiText = ["A"; "B"; "C"], + TextPosition = StyleParam.TextPosition.BottomCenter, + ShowMarkers = true, + LineColor = Color.fromColorScaleValues [0;1;2], + LineWidth = 10. + ) + +(*** condition: ipynb ***) +#if IPYNB +line3d2 +#endif // IPYNB + +(***hide***) +line3d2 |> GenericChart.toChartHTML +(*** include-it-raw ***) + + (** # 3D Bubble plots *) let bubble3d = - Chart.Bubble3d( + Chart.Bubble3D( [1,3,2; 6,5,4; 7,9,8], [10;20;30], - Labels = ["A"; "B"; "C"], + MultiText = ["A"; "B"; "C"], TextPosition = StyleParam.TextPosition.BottomCenter ) @@ -97,4 +143,29 @@ bubble3d (***hide***) bubble3d |> GenericChart.toChartHTML -(*** include-it-raw ***) \ No newline at end of file +(*** include-it-raw ***) + + +(** +## 3D bubble chart with colorscale +*) + +let bubble3d2 = + Chart.Bubble3D( + [1,3,2; 6,5,4; 7,9,8], + [10;20;30], + MultiText = ["A"; "B"; "C"], + TextPosition = StyleParam.TextPosition.BottomCenter, + MarkerColor = Color.fromColorScaleValues [0;1;2], + MarkerColorScale = StyleParam.Colorscale.Viridis + ) + +(*** condition: ipynb ***) +#if IPYNB +bubble3d2 +#endif // IPYNB + +(***hide***) +bubble3d2 |> GenericChart.toChartHTML +(*** include-it-raw ***) + diff --git a/docs/03_2_3d-mesh-plots.fsx b/docs/03_2_3d-mesh-plots.fsx index e108bffe8..4c80ae972 100644 --- a/docs/03_2_3d-mesh-plots.fsx +++ b/docs/03_2_3d-mesh-plots.fsx @@ -65,7 +65,7 @@ let c = Array.init 50 (fun _ -> rnd.NextDouble()) open Plotly.NET.TraceObjects let mesh3d = - Trace3D.initMesh3d + Trace3D.initMesh3D (fun mesh3d -> mesh3d?x <- a mesh3d?y <- b From 6f3fc4590525bb67185e29cf909e842a5f0dcab1 Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Thu, 18 Nov 2021 15:09:49 +0100 Subject: [PATCH 3/8] Update all 3D Traces --- src/Plotly.NET/Traces/Trace3D.fs | 658 ++++++++++++++++--------------- 1 file changed, 347 insertions(+), 311 deletions(-) diff --git a/src/Plotly.NET/Traces/Trace3D.fs b/src/Plotly.NET/Traces/Trace3D.fs index 801752879..af5c0a4c1 100644 --- a/src/Plotly.NET/Traces/Trace3D.fs +++ b/src/Plotly.NET/Traces/Trace3D.fs @@ -225,9 +225,12 @@ type Trace3DStyle() = /// Sets the z coordinates. /// Sets the surface color values, used for setting a color scale independent of `z`. /// Sets the text elements associated with each z value. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels. + /// Sets the text elements associated with each z value. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels. /// Same as `text`. + /// Same as `text`. /// Determines which trace information appear on hover. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired. /// Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>". To hide the secondary box completely, use an empty tag `<extra></extra>`. + /// Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>". To hide the secondary box completely, use an empty tag `<extra></extra>`. /// Sets the hover text formatting rulefor `x` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `xaxis.hoverformat`. /// Sets the hover text formatting rulefor `y` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `yaxis.hoverformat`. /// Sets the hover text formatting rulefor `z` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `zaxis.hoverformat`. @@ -269,13 +272,15 @@ type Trace3DStyle() = [] ?Y : seq<#IConvertible>, [] ?Z : seq<#seq<#IConvertible>>, [] ?SurfaceColor : Color, - [] ?Text : seq<#IConvertible>, - [] ?HoverText : seq<#IConvertible>, - [] ?HoverInfo : string, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?HoverText : string, + [] ?MultiHoverText : seq, + [] ?HoverInfo : StyleParam.HoverInfo, [] ?HoverTemplate : string, + [] ?MultiHoverTemplate : seq, [] ?XHoverFormat : string, [] ?YHoverFormat : string, - [] ?ZHoverFormat : string, [] ?Meta : string, [] ?CustomData : seq<#IConvertible>, [] ?Scene : StyleParam.SubPlotId, @@ -285,10 +290,11 @@ type Trace3DStyle() = [] ?ColorScale : StyleParam.Colorscale, [] ?ShowScale : bool, [] ?ReverseScale : bool, + [] ?ZHoverFormat : string, [] ?CAuto : bool, - [] ?CMin : float, - [] ?CMid : float, [] ?CMax : float, + [] ?CMid : float, + [] ?CMin : float, [] ?ConnectGaps : bool, [] ?Contours : Contours, [] ?HideSurface : bool, @@ -303,49 +309,49 @@ type Trace3DStyle() = ) = (fun (surface: #Trace) -> - Name |> DynObj.setValueOpt surface "name" - Visible |> DynObj.setValueOptBy surface "visible" StyleParam.Visible.convert - ShowLegend |> DynObj.setValueOpt surface "showlegend" - LegendRank |> DynObj.setValueOpt surface "legendrank" - LegendGroup |> DynObj.setValueOpt surface "legendgroup" - LegendGroupTitle |> DynObj.setValueOpt surface "legendgrouptitle" - Opacity |> DynObj.setValueOpt surface "opacity" - Ids |> DynObj.setValueOpt surface "ids" - X |> DynObj.setValueOpt surface "x" - Y |> DynObj.setValueOpt surface "y" - Z |> DynObj.setValueOpt surface "z" - SurfaceColor |> DynObj.setValueOpt surface "surfacecolor" - Text |> DynObj.setValueOpt surface "text" - HoverText |> DynObj.setValueOpt surface "hovertext" - HoverInfo |> DynObj.setValueOpt surface "hoverinfo" - HoverTemplate |> DynObj.setValueOpt surface "hovertemplate" - XHoverFormat |> DynObj.setValueOpt surface "xhoverformat" - YHoverFormat |> DynObj.setValueOpt surface "yhoverformat" - ZHoverFormat |> DynObj.setValueOpt surface "zhoverformat" - Meta |> DynObj.setValueOpt surface "meta" - CustomData |> DynObj.setValueOpt surface "customdata" - Scene |> DynObj.setValueOptBy surface "scene" StyleParam.SubPlotId.convert - ColorAxis |> DynObj.setValueOptBy surface "coloraxis" StyleParam.SubPlotId.convert - ColorBar |> DynObj.setValueOpt surface "colorbar" - AutoColorScale |> DynObj.setValueOpt surface "autocolorscale" - ColorScale |> DynObj.setValueOptBy surface "colorscale" StyleParam.Colorscale.convert - ShowScale |> DynObj.setValueOpt surface "showscale" - ReverseScale |> DynObj.setValueOpt surface "reversescale" - CAuto |> DynObj.setValueOpt surface "cauto" - CMin |> DynObj.setValueOpt surface "cmin" - CMid |> DynObj.setValueOpt surface "cmid" - CMax |> DynObj.setValueOpt surface "cmax" - ConnectGaps |> DynObj.setValueOpt surface "connectgaps" - Contours |> DynObj.setValueOpt surface "contours" - HideSurface |> DynObj.setValueOpt surface "hidesurface" - Hoverlabel |> DynObj.setValueOpt surface "hoverlabel" - Lighting |> DynObj.setValueOpt surface "lighting" - LightPosition |> DynObj.setValueOpt surface "lightposition" - OpacityScale |> DynObj.setValueOpt surface "opacityscale" - XCalendar |> DynObj.setValueOptBy surface "xcalendar" StyleParam.Calendar.convert - YCalendar |> DynObj.setValueOptBy surface "ycalendar" StyleParam.Calendar.convert - ZCalendar |> DynObj.setValueOptBy surface "zcalendar" StyleParam.Calendar.convert - UIRevision |> DynObj.setValueOpt surface "uirevision" + Name |> DynObj.setValueOpt surface "name" + Visible |> DynObj.setValueOptBy surface "visible" StyleParam.Visible.convert + ShowLegend |> DynObj.setValueOpt surface "showlegend" + LegendRank |> DynObj.setValueOpt surface "legendrank" + LegendGroup |> DynObj.setValueOpt surface "legendgroup" + LegendGroupTitle |> DynObj.setValueOpt surface "legendgrouptitle" + Opacity |> DynObj.setValueOpt surface "opacity" + Ids |> DynObj.setValueOpt surface "ids" + X |> DynObj.setValueOpt surface "x" + Y |> DynObj.setValueOpt surface "y" + Z |> DynObj.setValueOpt surface "z" + SurfaceColor |> DynObj.setValueOpt surface "surfacecolor" + (Text, MultiText) |> DynObj.setSingleOrMultiOpt surface "text" + (HoverText, MultiHoverText) |> DynObj.setSingleOrMultiOpt surface "hovertext" + HoverInfo |> DynObj.setValueOptBy surface "hoverinfo" StyleParam.HoverInfo.convert + (HoverTemplate, MultiHoverTemplate) |> DynObj.setSingleOrMultiOpt surface "hovertemplate" + XHoverFormat |> DynObj.setValueOpt surface "xhoverformat" + YHoverFormat |> DynObj.setValueOpt surface "yhoverformat" + ZHoverFormat |> DynObj.setValueOpt surface "zhoverformat" + Meta |> DynObj.setValueOpt surface "meta" + CustomData |> DynObj.setValueOpt surface "customdata" + Scene |> DynObj.setValueOptBy surface "scene" StyleParam.SubPlotId.convert + ColorAxis |> DynObj.setValueOptBy surface "coloraxis" StyleParam.SubPlotId.convert + ColorBar |> DynObj.setValueOpt surface "colorbar" + AutoColorScale |> DynObj.setValueOpt surface "autocolorscale" + ColorScale |> DynObj.setValueOptBy surface "colorscale" StyleParam.Colorscale.convert + ShowScale |> DynObj.setValueOpt surface "showscale" + ReverseScale |> DynObj.setValueOpt surface "reversescale" + CAuto |> DynObj.setValueOpt surface "cauto" + CMin |> DynObj.setValueOpt surface "cmin" + CMid |> DynObj.setValueOpt surface "cmid" + CMax |> DynObj.setValueOpt surface "cmax" + ConnectGaps |> DynObj.setValueOpt surface "connectgaps" + Contours |> DynObj.setValueOpt surface "contours" + HideSurface |> DynObj.setValueOpt surface "hidesurface" + Hoverlabel |> DynObj.setValueOpt surface "hoverlabel" + Lighting |> DynObj.setValueOpt surface "lighting" + LightPosition |> DynObj.setValueOpt surface "lightposition" + OpacityScale |> DynObj.setValueOpt surface "opacityscale" + XCalendar |> DynObj.setValueOptBy surface "xcalendar" StyleParam.Calendar.convert + YCalendar |> DynObj.setValueOptBy surface "ycalendar" StyleParam.Calendar.convert + ZCalendar |> DynObj.setValueOptBy surface "zcalendar" StyleParam.Calendar.convert + UIRevision |> DynObj.setValueOpt surface "uirevision" surface ) @@ -373,9 +379,12 @@ type Trace3DStyle() = /// Determines the source of `intensity` values. /// Sets the color of each vertex Overrides "color". While Red, green and blue colors are in the range of 0 and 255; in the case of having vertex color data in RGBA format, the alpha color should be normalized to be between 0 and 1. /// Sets the text elements associated with the vertices. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels. + /// Sets the text elements associated with the vertices. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels. /// Same as `text`. + /// Same as `text`. /// Determines which trace information appear on hover. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired. /// Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>". To hide the secondary box completely, use an empty tag `<extra></extra>`. + /// Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>". To hide the secondary box completely, use an empty tag `<extra></extra>`. /// Sets the hover text formatting rulefor `x` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `xaxis.hoverformat`. /// Sets the hover text formatting rulefor `y` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `yaxis.hoverformat`. /// Sets the hover text formatting rulefor `z` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `zaxis.hoverformat`. @@ -424,13 +433,15 @@ type Trace3DStyle() = [] ?Intensity : seq<#IConvertible>, [] ?IntensityMode : StyleParam.IntensityMode, [] ?VertexColor : Color, - [] ?Text : seq<#IConvertible>, - [] ?HoverText : seq<#IConvertible>, - [] ?HoverInfo : string, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?HoverText : string, + [] ?MultiHoverText : seq, + [] ?HoverInfo : StyleParam.HoverInfo, [] ?HoverTemplate : string, + [] ?MultiHoverTemplate : seq, [] ?XHoverFormat : string, [] ?YHoverFormat : string, - [] ?ZHoverFormat : string, [] ?Meta : string, [] ?CustomData : seq<#IConvertible>, [] ?Scene : StyleParam.SubPlotId, @@ -441,10 +452,11 @@ type Trace3DStyle() = [] ?ColorScale : StyleParam.Colorscale, [] ?ShowScale : bool, [] ?ReverseScale : bool, + [] ?ZHoverFormat : string, [] ?CAuto : bool, - [] ?CMin : float, - [] ?CMid : float, [] ?CMax : float, + [] ?CMid : float, + [] ?CMin : float, [] ?AlphaHull : float, [] ?Delaunayaxis : StyleParam.Delaunayaxis, [] ?Contour : Contour, @@ -460,56 +472,56 @@ type Trace3DStyle() = fun (mesh3d: #Trace) -> - Name |> DynObj.setValueOpt mesh3d "name" - Visible |> DynObj.setValueOptBy mesh3d "visible" StyleParam.Visible.convert - ShowLegend |> DynObj.setValueOpt mesh3d "showlegend" - LegendRank |> DynObj.setValueOpt mesh3d "legendrank" - LegendGroup |> DynObj.setValueOpt mesh3d "legendgroup" - LegendGroupTitle |> DynObj.setValueOpt mesh3d "legendgrouptitle" - Opacity |> DynObj.setValueOpt mesh3d "opacity" - Ids |> DynObj.setValueOpt mesh3d "ids" - X |> DynObj.setValueOpt mesh3d "x" - Y |> DynObj.setValueOpt mesh3d "y" - Z |> DynObj.setValueOpt mesh3d "z" - I |> DynObj.setValueOpt mesh3d "i" - J |> DynObj.setValueOpt mesh3d "j" - K |> DynObj.setValueOpt mesh3d "k" - FaceColor |> DynObj.setValueOpt mesh3d "facecolor" - Intensity |> DynObj.setValueOpt mesh3d "intensity" - IntensityMode |> DynObj.setValueOptBy mesh3d "intensitymode" StyleParam.IntensityMode.convert - VertexColor |> DynObj.setValueOpt mesh3d "vertexcolor" - Text |> DynObj.setValueOpt mesh3d "text" - HoverText |> DynObj.setValueOpt mesh3d "hovertext" - HoverInfo |> DynObj.setValueOpt mesh3d "hoverinfo" - HoverTemplate |> DynObj.setValueOpt mesh3d "hovertemplate" - XHoverFormat |> DynObj.setValueOpt mesh3d "xhoverformat" - YHoverFormat |> DynObj.setValueOpt mesh3d "yhoverformat" - ZHoverFormat |> DynObj.setValueOpt mesh3d "zhoverformat" - Meta |> DynObj.setValueOpt mesh3d "meta" - CustomData |> DynObj.setValueOpt mesh3d "customdata" - Scene |> DynObj.setValueOptBy mesh3d "scene" StyleParam.SubPlotId.convert - Color |> DynObj.setValueOpt mesh3d "color" - ColorAxis |> DynObj.setValueOptBy mesh3d "coloraxis" StyleParam.SubPlotId.convert - ColorBar |> DynObj.setValueOpt mesh3d "colorbar" - AutoColorScale |> DynObj.setValueOpt mesh3d "autocolorscale" - ColorScale |> DynObj.setValueOptBy mesh3d "colorscale" StyleParam.Colorscale.convert - ShowScale |> DynObj.setValueOpt mesh3d "showscale" - ReverseScale |> DynObj.setValueOpt mesh3d "reversescale" - CAuto |> DynObj.setValueOpt mesh3d "cauto" - CMin |> DynObj.setValueOpt mesh3d "cmin" - CMid |> DynObj.setValueOpt mesh3d "cmid" - CMax |> DynObj.setValueOpt mesh3d "cmax" - AlphaHull |> DynObj.setValueOpt mesh3d "alphahull" - Delaunayaxis |> DynObj.setValueOptBy mesh3d "delaunayaxis" StyleParam.Delaunayaxis.convert - Contour |> DynObj.setValueOpt mesh3d "contour" - FlatShading |> DynObj.setValueOpt mesh3d "flatshading" - Hoverlabel |> DynObj.setValueOpt mesh3d "hoverlabel" - Lighting |> DynObj.setValueOpt mesh3d "lighting" - LightPosition |> DynObj.setValueOpt mesh3d "lightposition" - XCalendar |> DynObj.setValueOptBy mesh3d "xcalendar" StyleParam.Calendar.convert - YCalendar |> DynObj.setValueOptBy mesh3d "ycalendar" StyleParam.Calendar.convert - ZCalendar |> DynObj.setValueOptBy mesh3d "zcalendar" StyleParam.Calendar.convert - UIRevision |> DynObj.setValueOpt mesh3d "uirevision" + Name |> DynObj.setValueOpt mesh3d "name" + Visible |> DynObj.setValueOptBy mesh3d "visible" StyleParam.Visible.convert + ShowLegend |> DynObj.setValueOpt mesh3d "showlegend" + LegendRank |> DynObj.setValueOpt mesh3d "legendrank" + LegendGroup |> DynObj.setValueOpt mesh3d "legendgroup" + LegendGroupTitle |> DynObj.setValueOpt mesh3d "legendgrouptitle" + Opacity |> DynObj.setValueOpt mesh3d "opacity" + Ids |> DynObj.setValueOpt mesh3d "ids" + X |> DynObj.setValueOpt mesh3d "x" + Y |> DynObj.setValueOpt mesh3d "y" + Z |> DynObj.setValueOpt mesh3d "z" + I |> DynObj.setValueOpt mesh3d "i" + J |> DynObj.setValueOpt mesh3d "j" + K |> DynObj.setValueOpt mesh3d "k" + FaceColor |> DynObj.setValueOpt mesh3d "facecolor" + Intensity |> DynObj.setValueOpt mesh3d "intensity" + IntensityMode |> DynObj.setValueOptBy mesh3d "intensitymode" StyleParam.IntensityMode.convert + VertexColor |> DynObj.setValueOpt mesh3d "vertexcolor" + (Text, MultiText) |> DynObj.setSingleOrMultiOpt mesh3d "text" + (HoverText, MultiHoverText) |> DynObj.setSingleOrMultiOpt mesh3d "hovertext" + HoverInfo |> DynObj.setValueOptBy mesh3d "hoverinfo" StyleParam.HoverInfo.convert + (HoverTemplate, MultiHoverTemplate) |> DynObj.setSingleOrMultiOpt mesh3d "hovertemplate" + XHoverFormat |> DynObj.setValueOpt mesh3d "xhoverformat" + YHoverFormat |> DynObj.setValueOpt mesh3d "yhoverformat" + ZHoverFormat |> DynObj.setValueOpt mesh3d "zhoverformat" + Meta |> DynObj.setValueOpt mesh3d "meta" + CustomData |> DynObj.setValueOpt mesh3d "customdata" + Scene |> DynObj.setValueOptBy mesh3d "scene" StyleParam.SubPlotId.convert + Color |> DynObj.setValueOpt mesh3d "color" + ColorAxis |> DynObj.setValueOptBy mesh3d "coloraxis" StyleParam.SubPlotId.convert + ColorBar |> DynObj.setValueOpt mesh3d "colorbar" + AutoColorScale |> DynObj.setValueOpt mesh3d "autocolorscale" + ColorScale |> DynObj.setValueOptBy mesh3d "colorscale" StyleParam.Colorscale.convert + ShowScale |> DynObj.setValueOpt mesh3d "showscale" + ReverseScale |> DynObj.setValueOpt mesh3d "reversescale" + CAuto |> DynObj.setValueOpt mesh3d "cauto" + CMin |> DynObj.setValueOpt mesh3d "cmin" + CMid |> DynObj.setValueOpt mesh3d "cmid" + CMax |> DynObj.setValueOpt mesh3d "cmax" + AlphaHull |> DynObj.setValueOpt mesh3d "alphahull" + Delaunayaxis |> DynObj.setValueOptBy mesh3d "delaunayaxis" StyleParam.Delaunayaxis.convert + Contour |> DynObj.setValueOpt mesh3d "contour" + FlatShading |> DynObj.setValueOpt mesh3d "flatshading" + Hoverlabel |> DynObj.setValueOpt mesh3d "hoverlabel" + Lighting |> DynObj.setValueOpt mesh3d "lighting" + LightPosition |> DynObj.setValueOpt mesh3d "lightposition" + XCalendar |> DynObj.setValueOptBy mesh3d "xcalendar" StyleParam.Calendar.convert + YCalendar |> DynObj.setValueOptBy mesh3d "ycalendar" StyleParam.Calendar.convert + ZCalendar |> DynObj.setValueOptBy mesh3d "zcalendar" StyleParam.Calendar.convert + UIRevision |> DynObj.setValueOpt mesh3d "uirevision" mesh3d @@ -532,9 +544,12 @@ type Trace3DStyle() = /// Sets the y components of the vector field. /// Sets the z components of the vector field. /// Sets the text elements associated with the cones. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels. + /// Sets the text elements associated with the cones. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels. /// Same as `text`. + /// Same as `text`. /// Determines which trace information appear on hover. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired. /// Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>". To hide the secondary box completely, use an empty tag `<extra></extra>`. + /// Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>". To hide the secondary box completely, use an empty tag `<extra></extra>`. /// Sets the hover text formatting rulefor `x` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `xaxis.hoverformat`. /// Sets the hover text formatting rulefor `y` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `yaxis.hoverformat`. /// Sets the hover text formatting rulefor `z` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `zaxis.hoverformat` @@ -577,13 +592,15 @@ type Trace3DStyle() = [] ?U : seq<#IConvertible>, [] ?V : seq<#IConvertible>, [] ?W : seq<#IConvertible>, - [] ?Text : seq<#IConvertible>, - [] ?HoverText : seq<#IConvertible>, - [] ?HoverInfo : string, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?HoverText : string, + [] ?MultiHoverText : seq, + [] ?HoverInfo : StyleParam.HoverInfo, [] ?HoverTemplate : string, + [] ?MultiHoverTemplate : seq, [] ?XHoverFormat : string, [] ?YHoverFormat : string, - [] ?ZHoverFormat : string, [] ?UHoverFormat : string, [] ?VHoverFormat : string, [] ?WHoverFormat : string, @@ -596,10 +613,11 @@ type Trace3DStyle() = [] ?ColorScale : StyleParam.Colorscale, [] ?ShowScale : bool, [] ?ReverseScale : bool, + [] ?ZHoverFormat : string, [] ?CAuto : bool, - [] ?CMin : float, - [] ?CMid : float, [] ?CMax : float, + [] ?CMid : float, + [] ?CMin : float, [] ?Anchor : StyleParam.ConeAnchor, [] ?HoverLabel : Hoverlabel, [] ?Lighting : Lighting, @@ -610,50 +628,50 @@ type Trace3DStyle() = ) = (fun (cone: #Trace) -> - Name |> DynObj.setValueOpt cone "name" - Visible |> DynObj.setValueOptBy cone "visible" StyleParam.Visible.convert - ShowLegend |> DynObj.setValueOpt cone "showlegend" - LegendRank |> DynObj.setValueOpt cone "legendrank" - LegendGroup |> DynObj.setValueOpt cone "legendgroup" - LegendGroupTitle |> DynObj.setValueOpt cone "legendgrouptitle" - Opacity |> DynObj.setValueOpt cone "opacity" - Ids |> DynObj.setValueOpt cone "ids" - X |> DynObj.setValueOpt cone "x" - Y |> DynObj.setValueOpt cone "y" - Z |> DynObj.setValueOpt cone "z" - U |> DynObj.setValueOpt cone "u" - V |> DynObj.setValueOpt cone "v" - W |> DynObj.setValueOpt cone "w" - Text |> DynObj.setValueOpt cone "text" - HoverText |> DynObj.setValueOpt cone "hovertext" - HoverInfo |> DynObj.setValueOpt cone "hoverinfo" - HoverTemplate |> DynObj.setValueOpt cone "hovertemplate" - XHoverFormat |> DynObj.setValueOpt cone "xhoverformat" - YHoverFormat |> DynObj.setValueOpt cone "yhoverformat" - ZHoverFormat |> DynObj.setValueOpt cone "zhoverformat" - UHoverFormat |> DynObj.setValueOpt cone "uhoverformat" - VHoverFormat |> DynObj.setValueOpt cone "vhoverformat" - WHoverFormat |> DynObj.setValueOpt cone "whoverformat" - Meta |> DynObj.setValueOpt cone "meta" - CustomData |> DynObj.setValueOpt cone "customdata" - Scene |> DynObj.setValueOptBy cone "scene" StyleParam.SubPlotId.convert - ColorAxis |> DynObj.setValueOptBy cone "scene" StyleParam.SubPlotId.convert - ColorBar |> DynObj.setValueOpt cone "colorbar" - AutoColorScale |> DynObj.setValueOpt cone "autocolorscale" - ColorScale |> DynObj.setValueOptBy cone "colorscale" StyleParam.Colorscale.convert - ShowScale |> DynObj.setValueOpt cone "showscale" - ReverseScale |> DynObj.setValueOpt cone "reversescale" - CAuto |> DynObj.setValueOpt cone "cauto" - CMin |> DynObj.setValueOpt cone "cmin" - CMid |> DynObj.setValueOpt cone "cmid" - CMax |> DynObj.setValueOpt cone "cmax" - Anchor |> DynObj.setValueOptBy cone "anchor" StyleParam.ConeAnchor.convert - HoverLabel |> DynObj.setValueOpt cone "hoverlabel" - Lighting |> DynObj.setValueOpt cone "lighting" - LightPosition |> DynObj.setValueOpt cone "lightposition" - SizeMode |> DynObj.setValueOptBy cone "sizemode" StyleParam.ConeSizeMode.convert - SizeRef |> DynObj.setValueOpt cone "sizeref" - UIRevision |> DynObj.setValueOpt cone "uirevision" + Name |> DynObj.setValueOpt cone "name" + Visible |> DynObj.setValueOptBy cone "visible" StyleParam.Visible.convert + ShowLegend |> DynObj.setValueOpt cone "showlegend" + LegendRank |> DynObj.setValueOpt cone "legendrank" + LegendGroup |> DynObj.setValueOpt cone "legendgroup" + LegendGroupTitle |> DynObj.setValueOpt cone "legendgrouptitle" + Opacity |> DynObj.setValueOpt cone "opacity" + Ids |> DynObj.setValueOpt cone "ids" + X |> DynObj.setValueOpt cone "x" + Y |> DynObj.setValueOpt cone "y" + Z |> DynObj.setValueOpt cone "z" + U |> DynObj.setValueOpt cone "u" + V |> DynObj.setValueOpt cone "v" + W |> DynObj.setValueOpt cone "w" + (Text, MultiText) |> DynObj.setSingleOrMultiOpt cone "text" + (HoverText, MultiHoverText) |> DynObj.setSingleOrMultiOpt cone "hovertext" + HoverInfo |> DynObj.setValueOptBy cone "hoverinfo" StyleParam.HoverInfo.convert + (HoverTemplate, MultiHoverTemplate) |> DynObj.setSingleOrMultiOpt cone "hovertemplate" + XHoverFormat |> DynObj.setValueOpt cone "xhoverformat" + YHoverFormat |> DynObj.setValueOpt cone "yhoverformat" + ZHoverFormat |> DynObj.setValueOpt cone "zhoverformat" + UHoverFormat |> DynObj.setValueOpt cone "uhoverformat" + VHoverFormat |> DynObj.setValueOpt cone "vhoverformat" + WHoverFormat |> DynObj.setValueOpt cone "whoverformat" + Meta |> DynObj.setValueOpt cone "meta" + CustomData |> DynObj.setValueOpt cone "customdata" + Scene |> DynObj.setValueOptBy cone "scene" StyleParam.SubPlotId.convert + ColorAxis |> DynObj.setValueOptBy cone "scene" StyleParam.SubPlotId.convert + ColorBar |> DynObj.setValueOpt cone "colorbar" + AutoColorScale |> DynObj.setValueOpt cone "autocolorscale" + ColorScale |> DynObj.setValueOptBy cone "colorscale" StyleParam.Colorscale.convert + ShowScale |> DynObj.setValueOpt cone "showscale" + ReverseScale |> DynObj.setValueOpt cone "reversescale" + CAuto |> DynObj.setValueOpt cone "cauto" + CMin |> DynObj.setValueOpt cone "cmin" + CMid |> DynObj.setValueOpt cone "cmid" + CMax |> DynObj.setValueOpt cone "cmax" + Anchor |> DynObj.setValueOptBy cone "anchor" StyleParam.ConeAnchor.convert + HoverLabel |> DynObj.setValueOpt cone "hoverlabel" + Lighting |> DynObj.setValueOpt cone "lighting" + LightPosition |> DynObj.setValueOpt cone "lightposition" + SizeMode |> DynObj.setValueOptBy cone "sizemode" StyleParam.ConeSizeMode.convert + SizeRef |> DynObj.setValueOpt cone "sizeref" + UIRevision |> DynObj.setValueOpt cone "uirevision" cone ) @@ -676,9 +694,12 @@ type Trace3DStyle() = /// Sets the y components of the vector field. /// Sets the z components of the vector field. /// Sets a text element associated with this trace. If trace `hoverinfo` contains a "text" flag, this text element will be seen in all hover labels. Note that streamtube traces do not support array `text` values. + /// Sets a text element associated with this trace. If trace `hoverinfo` contains a "text" flag, this text element will be seen in all hover labels. Note that streamtube traces do not support array `text` values. /// Same as `text`. + /// Same as `text`. /// Determines which trace information appear on hover. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired. /// Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>". To hide the secondary box completely, use an empty tag `<extra></extra>`. + /// Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>". To hide the secondary box completely, use an empty tag `<extra></extra>`. /// Sets the hover text formatting rulefor `x` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `xaxis.hoverformat`. /// Sets the hover text formatting rulefor `y` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `yaxis.hoverformat`. /// Sets the hover text formatting rulefor `z` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `zaxis.hoverformat` @@ -721,13 +742,15 @@ type Trace3DStyle() = [] ?U : seq<#IConvertible>, [] ?V : seq<#IConvertible>, [] ?W : seq<#IConvertible>, - [] ?Text : seq<#IConvertible>, - [] ?HoverText : seq<#IConvertible>, - [] ?HoverInfo : string, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?HoverText : string, + [] ?MultiHoverText : seq, + [] ?HoverInfo : StyleParam.HoverInfo, [] ?HoverTemplate : string, + [] ?MultiHoverTemplate : seq, [] ?XHoverFormat : string, [] ?YHoverFormat : string, - [] ?ZHoverFormat : string, [] ?UHoverFormat : string, [] ?VHoverFormat : string, [] ?WHoverFormat : string, @@ -740,10 +763,11 @@ type Trace3DStyle() = [] ?ColorScale : StyleParam.Colorscale, [] ?ShowScale : bool, [] ?ReverseScale : bool, + [] ?ZHoverFormat : string, [] ?CAuto : bool, - [] ?CMin : float, - [] ?CMid : float, [] ?CMax : float, + [] ?CMid : float, + [] ?CMin : float, [] ?HoverLabel : Hoverlabel, [] ?Lighting : Lighting, [] ?LightPosition : LightPosition, @@ -754,50 +778,50 @@ type Trace3DStyle() = ) = (fun (streamTube: #Trace) -> - Name |> DynObj.setValueOpt streamTube "name" - Visible |> DynObj.setValueOptBy streamTube "visible" StyleParam.Visible.convert - ShowLegend |> DynObj.setValueOpt streamTube "showlegend" - LegendRank |> DynObj.setValueOpt streamTube "legendrank" - LegendGroup |> DynObj.setValueOpt streamTube "legendgroup" - LegendGroupTitle |> DynObj.setValueOpt streamTube "legendgrouptitle" - Opacity |> DynObj.setValueOpt streamTube "opacity" - Ids |> DynObj.setValueOpt streamTube "ids" - X |> DynObj.setValueOpt streamTube "x" - Y |> DynObj.setValueOpt streamTube "y" - Z |> DynObj.setValueOpt streamTube "z" - U |> DynObj.setValueOpt streamTube "u" - V |> DynObj.setValueOpt streamTube "v" - W |> DynObj.setValueOpt streamTube "w" - Text |> DynObj.setValueOpt streamTube "text" - HoverText |> DynObj.setValueOpt streamTube "hovertext" - HoverInfo |> DynObj.setValueOpt streamTube "hoverinfo" - HoverTemplate |> DynObj.setValueOpt streamTube "hovertemplate" - XHoverFormat |> DynObj.setValueOpt streamTube "xhoverformat" - YHoverFormat |> DynObj.setValueOpt streamTube "yhoverformat" - ZHoverFormat |> DynObj.setValueOpt streamTube "zhoverformat" - UHoverFormat |> DynObj.setValueOpt streamTube "uhoverformat" - VHoverFormat |> DynObj.setValueOpt streamTube "vhoverformat" - WHoverFormat |> DynObj.setValueOpt streamTube "whoverformat" - Meta |> DynObj.setValueOpt streamTube "meta" - CustomData |> DynObj.setValueOpt streamTube "customdata" - Scene |> DynObj.setValueOptBy streamTube "scene" StyleParam.SubPlotId.convert - ColorAxis |> DynObj.setValueOptBy streamTube "scene" StyleParam.SubPlotId.convert - ColorBar |> DynObj.setValueOpt streamTube "colorbar" - AutoColorScale |> DynObj.setValueOpt streamTube "autocolorscale" - ColorScale |> DynObj.setValueOptBy streamTube "colorscale" StyleParam.Colorscale.convert - ShowScale |> DynObj.setValueOpt streamTube "showscale" - ReverseScale |> DynObj.setValueOpt streamTube "reversescale" - CAuto |> DynObj.setValueOpt streamTube "cauto" - CMin |> DynObj.setValueOpt streamTube "cmin" - CMid |> DynObj.setValueOpt streamTube "cmid" - CMax |> DynObj.setValueOpt streamTube "cmax" - HoverLabel |> DynObj.setValueOpt streamTube "hoverlabel" - Lighting |> DynObj.setValueOpt streamTube "lighting" - LightPosition |> DynObj.setValueOpt streamTube "lightposition" - MaxDisplayed |> DynObj.setValueOpt streamTube "maxdisplayed" - SizeRef |> DynObj.setValueOpt streamTube "sizeref" - Starts |> DynObj.setValueOpt streamTube "starts" - UIRevision |> DynObj.setValueOpt streamTube "uirevision" + Name |> DynObj.setValueOpt streamTube "name" + Visible |> DynObj.setValueOptBy streamTube "visible" StyleParam.Visible.convert + ShowLegend |> DynObj.setValueOpt streamTube "showlegend" + LegendRank |> DynObj.setValueOpt streamTube "legendrank" + LegendGroup |> DynObj.setValueOpt streamTube "legendgroup" + LegendGroupTitle |> DynObj.setValueOpt streamTube "legendgrouptitle" + Opacity |> DynObj.setValueOpt streamTube "opacity" + Ids |> DynObj.setValueOpt streamTube "ids" + X |> DynObj.setValueOpt streamTube "x" + Y |> DynObj.setValueOpt streamTube "y" + Z |> DynObj.setValueOpt streamTube "z" + U |> DynObj.setValueOpt streamTube "u" + V |> DynObj.setValueOpt streamTube "v" + W |> DynObj.setValueOpt streamTube "w" + (Text, MultiText) |> DynObj.setSingleOrMultiOpt streamTube "text" + (HoverText, MultiHoverText) |> DynObj.setSingleOrMultiOpt streamTube "hovertext" + HoverInfo |> DynObj.setValueOptBy streamTube "hoverinfo" StyleParam.HoverInfo.convert + (HoverTemplate, MultiHoverTemplate) |> DynObj.setSingleOrMultiOpt streamTube "hovertemplate" + XHoverFormat |> DynObj.setValueOpt streamTube "xhoverformat" + YHoverFormat |> DynObj.setValueOpt streamTube "yhoverformat" + ZHoverFormat |> DynObj.setValueOpt streamTube "zhoverformat" + UHoverFormat |> DynObj.setValueOpt streamTube "uhoverformat" + VHoverFormat |> DynObj.setValueOpt streamTube "vhoverformat" + WHoverFormat |> DynObj.setValueOpt streamTube "whoverformat" + Meta |> DynObj.setValueOpt streamTube "meta" + CustomData |> DynObj.setValueOpt streamTube "customdata" + Scene |> DynObj.setValueOptBy streamTube "scene" StyleParam.SubPlotId.convert + ColorAxis |> DynObj.setValueOptBy streamTube "scene" StyleParam.SubPlotId.convert + ColorBar |> DynObj.setValueOpt streamTube "colorbar" + AutoColorScale |> DynObj.setValueOpt streamTube "autocolorscale" + ColorScale |> DynObj.setValueOptBy streamTube "colorscale" StyleParam.Colorscale.convert + ShowScale |> DynObj.setValueOpt streamTube "showscale" + ReverseScale |> DynObj.setValueOpt streamTube "reversescale" + CAuto |> DynObj.setValueOpt streamTube "cauto" + CMin |> DynObj.setValueOpt streamTube "cmin" + CMid |> DynObj.setValueOpt streamTube "cmid" + CMax |> DynObj.setValueOpt streamTube "cmax" + HoverLabel |> DynObj.setValueOpt streamTube "hoverlabel" + Lighting |> DynObj.setValueOpt streamTube "lighting" + LightPosition |> DynObj.setValueOpt streamTube "lightposition" + MaxDisplayed |> DynObj.setValueOpt streamTube "maxdisplayed" + SizeRef |> DynObj.setValueOpt streamTube "sizeref" + Starts |> DynObj.setValueOpt streamTube "starts" + UIRevision |> DynObj.setValueOpt streamTube "uirevision" streamTube ) @@ -818,9 +842,12 @@ type Trace3DStyle() = /// Sets the Z coordinates of the vertices on Z axis. /// Sets the 4th dimension (value) of the vertices. /// Sets the text elements associated with the vertices. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels. + /// Sets the text elements associated with the vertices. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels. /// Same as `text`. + /// Same as `text`. /// Determines which trace information appear on hover. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired. /// Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>". To hide the secondary box completely, use an empty tag `<extra></extra>`. + /// Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>". To hide the secondary box completely, use an empty tag `<extra></extra>`. /// Sets the hover text formatting rulefor `x` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `xaxis.hoverformat`. /// Sets the hover text formatting rulefor `y` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `yaxis.hoverformat`. /// Sets the hover text formatting rulefor `z` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `zaxis.hoverformat` @@ -865,13 +892,15 @@ type Trace3DStyle() = [] ?Y : seq<#IConvertible>, [] ?Z : seq<#IConvertible>, [] ?Value : seq<#IConvertible>, - [] ?Text : seq<#IConvertible>, - [] ?HoverText : seq<#IConvertible>, - [] ?HoverInfo : string, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?HoverText : string, + [] ?MultiHoverText : seq, + [] ?HoverInfo : StyleParam.HoverInfo, [] ?HoverTemplate : string, + [] ?MultiHoverTemplate : seq, [] ?XHoverFormat : string, [] ?YHoverFormat : string, - [] ?ZHoverFormat : string, [] ?ValueHoverFormat : string, [] ?Meta : seq<#IConvertible>, [] ?CustomData : seq<#IConvertible>, @@ -882,10 +911,11 @@ type Trace3DStyle() = [] ?ColorScale : StyleParam.Colorscale, [] ?ShowScale : bool, [] ?ReverseScale : bool, + [] ?ZHoverFormat : string, [] ?CAuto : bool, - [] ?CMin : float, - [] ?CMid : float, [] ?CMax : float, + [] ?CMid : float, + [] ?CMin : float, [] ?Caps : Caps, [] ?Contour : Contour, [] ?FlatShading : bool, @@ -902,52 +932,52 @@ type Trace3DStyle() = ) = fun (volume: #Trace) -> - Name |> DynObj.setValueOpt volume "name" - Visible |> DynObj.setValueOptBy volume "visible" StyleParam.Visible.convert - ShowLegend |> DynObj.setValueOpt volume "showlegend" - LegendRank |> DynObj.setValueOpt volume "legendrank" - LegendGroup |> DynObj.setValueOpt volume "legendgroup" - LegendGroupTitle |> DynObj.setValueOpt volume "legendgrouptitle" - Opacity |> DynObj.setValueOpt volume "opacity" - Ids |> DynObj.setValueOpt volume "ids" - X |> DynObj.setValueOpt volume "x" - Y |> DynObj.setValueOpt volume "y" - Z |> DynObj.setValueOpt volume "z" - Value |> DynObj.setValueOpt volume "value" - Text |> DynObj.setValueOpt volume "text" - HoverText |> DynObj.setValueOpt volume "hovertext" - HoverInfo |> DynObj.setValueOpt volume "hoverinfo" - HoverTemplate |> DynObj.setValueOpt volume "hovertemplate" - XHoverFormat |> DynObj.setValueOpt volume "xhoverformat" - YHoverFormat |> DynObj.setValueOpt volume "yhoverformat" - ZHoverFormat |> DynObj.setValueOpt volume "zhoverformat" - ValueHoverFormat |> DynObj.setValueOpt volume "valuehoverformat" - Meta |> DynObj.setValueOpt volume "meta" - CustomData |> DynObj.setValueOpt volume "customdata" - Scene |> DynObj.setValueOptBy volume "scene" StyleParam.SubPlotId.convert - ColorAxis |> DynObj.setValueOptBy volume "scene" StyleParam.SubPlotId.convert - ColorBar |> DynObj.setValueOpt volume "colorbar" - AutoColorScale |> DynObj.setValueOpt volume "autocolorscale" - ColorScale |> DynObj.setValueOptBy volume "colorscale" StyleParam.Colorscale.convert - ShowScale |> DynObj.setValueOpt volume "showscale" - ReverseScale |> DynObj.setValueOpt volume "reversescale" - CAuto |> DynObj.setValueOpt volume "cauto" - CMin |> DynObj.setValueOpt volume "cmin" - CMid |> DynObj.setValueOpt volume "cmid" - CMax |> DynObj.setValueOpt volume "cmax" - Caps |> DynObj.setValueOpt volume "caps" - Contour |> DynObj.setValueOpt volume "contour" - FlatShading |> DynObj.setValueOpt volume "flatshading" - HoverLabel |> DynObj.setValueOpt volume "hoverlabel" - IsoMax |> DynObj.setValueOpt volume "isomax" - IsoMin |> DynObj.setValueOpt volume "isomin" - Lighting |> DynObj.setValueOpt volume "lighting" - LightPosition |> DynObj.setValueOpt volume "lightposition" - OpacityScale |> DynObj.setValueOpt volume "opacityscale" - Slices |> DynObj.setValueOpt volume "slices" - SpaceFrame |> DynObj.setValueOpt volume "spaceframe" - Surface |> DynObj.setValueOpt volume "surface" - UIRevision |> DynObj.setValueOpt volume "uirevision" + Name |> DynObj.setValueOpt volume "name" + Visible |> DynObj.setValueOptBy volume "visible" StyleParam.Visible.convert + ShowLegend |> DynObj.setValueOpt volume "showlegend" + LegendRank |> DynObj.setValueOpt volume "legendrank" + LegendGroup |> DynObj.setValueOpt volume "legendgroup" + LegendGroupTitle |> DynObj.setValueOpt volume "legendgrouptitle" + Opacity |> DynObj.setValueOpt volume "opacity" + Ids |> DynObj.setValueOpt volume "ids" + X |> DynObj.setValueOpt volume "x" + Y |> DynObj.setValueOpt volume "y" + Z |> DynObj.setValueOpt volume "z" + Value |> DynObj.setValueOpt volume "value" + (Text, MultiText) |> DynObj.setSingleOrMultiOpt volume "text" + (HoverText, MultiHoverText) |> DynObj.setSingleOrMultiOpt volume "hovertext" + HoverInfo |> DynObj.setValueOptBy volume "hoverinfo" StyleParam.HoverInfo.convert + (HoverTemplate, MultiHoverTemplate) |> DynObj.setSingleOrMultiOpt volume "hovertemplate" + XHoverFormat |> DynObj.setValueOpt volume "xhoverformat" + YHoverFormat |> DynObj.setValueOpt volume "yhoverformat" + ZHoverFormat |> DynObj.setValueOpt volume "zhoverformat" + ValueHoverFormat |> DynObj.setValueOpt volume "valuehoverformat" + Meta |> DynObj.setValueOpt volume "meta" + CustomData |> DynObj.setValueOpt volume "customdata" + Scene |> DynObj.setValueOptBy volume "scene" StyleParam.SubPlotId.convert + ColorAxis |> DynObj.setValueOptBy volume "scene" StyleParam.SubPlotId.convert + ColorBar |> DynObj.setValueOpt volume "colorbar" + AutoColorScale |> DynObj.setValueOpt volume "autocolorscale" + ColorScale |> DynObj.setValueOptBy volume "colorscale" StyleParam.Colorscale.convert + ShowScale |> DynObj.setValueOpt volume "showscale" + ReverseScale |> DynObj.setValueOpt volume "reversescale" + CAuto |> DynObj.setValueOpt volume "cauto" + CMin |> DynObj.setValueOpt volume "cmin" + CMid |> DynObj.setValueOpt volume "cmid" + CMax |> DynObj.setValueOpt volume "cmax" + Caps |> DynObj.setValueOpt volume "caps" + Contour |> DynObj.setValueOpt volume "contour" + FlatShading |> DynObj.setValueOpt volume "flatshading" + HoverLabel |> DynObj.setValueOpt volume "hoverlabel" + IsoMax |> DynObj.setValueOpt volume "isomax" + IsoMin |> DynObj.setValueOpt volume "isomin" + Lighting |> DynObj.setValueOpt volume "lighting" + LightPosition |> DynObj.setValueOpt volume "lightposition" + OpacityScale |> DynObj.setValueOpt volume "opacityscale" + Slices |> DynObj.setValueOpt volume "slices" + SpaceFrame |> DynObj.setValueOpt volume "spaceframe" + Surface |> DynObj.setValueOpt volume "surface" + UIRevision |> DynObj.setValueOpt volume "uirevision" volume @@ -967,9 +997,12 @@ type Trace3DStyle() = /// Sets the Z coordinates of the vertices on Z axis. /// Sets the 4th dimension (value) of the vertices. /// Sets the text elements associated with the vertices. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels. + /// Sets the text elements associated with the vertices. If trace `hoverinfo` contains a "text" flag and "hovertext" is not set, these elements will be seen in the hover labels. /// Same as `text`. + /// Same as `text`. /// Determines which trace information appear on hover. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired. /// Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>". To hide the secondary box completely, use an empty tag `<extra></extra>`. + /// Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, "xother" will be added to those with different x positions from the first point. An underscore before or after "(x|y)other" will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. variable `norm` Anything contained in tag `<extra>` is displayed in the secondary box, for example "<extra>{fullData.name}</extra>". To hide the secondary box completely, use an empty tag `<extra></extra>`. /// Sets the hover text formatting rulefor `x` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `xaxis.hoverformat`. /// Sets the hover text formatting rulefor `y` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `yaxis.hoverformat`. /// Sets the hover text formatting rulefor `z` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"By default the values are formatted using `zaxis.hoverformat` @@ -1014,13 +1047,15 @@ type Trace3DStyle() = [] ?Y : seq<#IConvertible>, [] ?Z : seq<#IConvertible>, [] ?Value : seq<#IConvertible>, - [] ?Text : seq<#IConvertible>, - [] ?HoverText : seq<#IConvertible>, - [] ?HoverInfo : string, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?HoverText : string, + [] ?MultiHoverText : seq, + [] ?HoverInfo : StyleParam.HoverInfo, [] ?HoverTemplate : string, + [] ?MultiHoverTemplate : seq, [] ?XHoverFormat : string, [] ?YHoverFormat : string, - [] ?ZHoverFormat : string, [] ?ValueHoverFormat : string, [] ?Meta : seq<#IConvertible>, [] ?CustomData : seq<#IConvertible>, @@ -1031,10 +1066,11 @@ type Trace3DStyle() = [] ?ColorScale : StyleParam.Colorscale, [] ?ShowScale : bool, [] ?ReverseScale : bool, + [] ?ZHoverFormat : string, [] ?CAuto : bool, - [] ?CMin : float, - [] ?CMid : float, [] ?CMax : float, + [] ?CMid : float, + [] ?CMin : float, [] ?Caps : Caps, [] ?Contour : Contour, [] ?FlatShading : bool, @@ -1049,53 +1085,53 @@ type Trace3DStyle() = [] ?Surface : Surface, [] ?UIRevision : seq<#IConvertible> ) = - fun (volume: #Trace) -> + fun (isoSurface: #Trace) -> - Name |> DynObj.setValueOpt volume "name" - Visible |> DynObj.setValueOptBy volume "visible" StyleParam.Visible.convert - ShowLegend |> DynObj.setValueOpt volume "showlegend" - LegendRank |> DynObj.setValueOpt volume "legendrank" - LegendGroup |> DynObj.setValueOpt volume "legendgroup" - LegendGroupTitle |> DynObj.setValueOpt volume "legendgrouptitle" - Opacity |> DynObj.setValueOpt volume "opacity" - Ids |> DynObj.setValueOpt volume "ids" - X |> DynObj.setValueOpt volume "x" - Y |> DynObj.setValueOpt volume "y" - Z |> DynObj.setValueOpt volume "z" - Value |> DynObj.setValueOpt volume "value" - Text |> DynObj.setValueOpt volume "text" - HoverText |> DynObj.setValueOpt volume "hovertext" - HoverInfo |> DynObj.setValueOpt volume "hoverinfo" - HoverTemplate |> DynObj.setValueOpt volume "hovertemplate" - XHoverFormat |> DynObj.setValueOpt volume "xhoverformat" - YHoverFormat |> DynObj.setValueOpt volume "yhoverformat" - ZHoverFormat |> DynObj.setValueOpt volume "zhoverformat" - ValueHoverFormat |> DynObj.setValueOpt volume "valuehoverformat" - Meta |> DynObj.setValueOpt volume "meta" - CustomData |> DynObj.setValueOpt volume "customdata" - Scene |> DynObj.setValueOptBy volume "scene" StyleParam.SubPlotId.convert - ColorAxis |> DynObj.setValueOptBy volume "scene" StyleParam.SubPlotId.convert - ColorBar |> DynObj.setValueOpt volume "colorbar" - AutoColorScale |> DynObj.setValueOpt volume "autocolorscale" - ColorScale |> DynObj.setValueOptBy volume "colorscale" StyleParam.Colorscale.convert - ShowScale |> DynObj.setValueOpt volume "showscale" - ReverseScale |> DynObj.setValueOpt volume "reversescale" - CAuto |> DynObj.setValueOpt volume "cauto" - CMin |> DynObj.setValueOpt volume "cmin" - CMid |> DynObj.setValueOpt volume "cmid" - CMax |> DynObj.setValueOpt volume "cmax" - Caps |> DynObj.setValueOpt volume "caps" - Contour |> DynObj.setValueOpt volume "contour" - FlatShading |> DynObj.setValueOpt volume "flatshading" - HoverLabel |> DynObj.setValueOpt volume "hoverlabel" - IsoMax |> DynObj.setValueOpt volume "isomax" - IsoMin |> DynObj.setValueOpt volume "isomin" - Lighting |> DynObj.setValueOpt volume "lighting" - LightPosition |> DynObj.setValueOpt volume "lightposition" - OpacityScale |> DynObj.setValueOpt volume "opacityscale" - Slices |> DynObj.setValueOpt volume "slices" - SpaceFrame |> DynObj.setValueOpt volume "spaceframe" - Surface |> DynObj.setValueOpt volume "surface" - UIRevision |> DynObj.setValueOpt volume "uirevision" + Name |> DynObj.setValueOpt isoSurface "name" + Visible |> DynObj.setValueOptBy isoSurface "visible" StyleParam.Visible.convert + ShowLegend |> DynObj.setValueOpt isoSurface "showlegend" + LegendRank |> DynObj.setValueOpt isoSurface "legendrank" + LegendGroup |> DynObj.setValueOpt isoSurface "legendgroup" + LegendGroupTitle |> DynObj.setValueOpt isoSurface "legendgrouptitle" + Opacity |> DynObj.setValueOpt isoSurface "opacity" + Ids |> DynObj.setValueOpt isoSurface "ids" + X |> DynObj.setValueOpt isoSurface "x" + Y |> DynObj.setValueOpt isoSurface "y" + Z |> DynObj.setValueOpt isoSurface "z" + Value |> DynObj.setValueOpt isoSurface "value" + (Text, MultiText) |> DynObj.setSingleOrMultiOpt isoSurface "text" + (HoverText, MultiHoverText) |> DynObj.setSingleOrMultiOpt isoSurface "hovertext" + HoverInfo |> DynObj.setValueOptBy isoSurface "hoverinfo" StyleParam.HoverInfo.convert + (HoverTemplate, MultiHoverTemplate) |> DynObj.setSingleOrMultiOpt isoSurface "hovertemplate" + XHoverFormat |> DynObj.setValueOpt isoSurface "xhoverformat" + YHoverFormat |> DynObj.setValueOpt isoSurface "yhoverformat" + ZHoverFormat |> DynObj.setValueOpt isoSurface "zhoverformat" + ValueHoverFormat |> DynObj.setValueOpt isoSurface "valuehoverformat" + Meta |> DynObj.setValueOpt isoSurface "meta" + CustomData |> DynObj.setValueOpt isoSurface "customdata" + Scene |> DynObj.setValueOptBy isoSurface "scene" StyleParam.SubPlotId.convert + ColorAxis |> DynObj.setValueOptBy isoSurface "scene" StyleParam.SubPlotId.convert + ColorBar |> DynObj.setValueOpt isoSurface "colorbar" + AutoColorScale |> DynObj.setValueOpt isoSurface "autocolorscale" + ColorScale |> DynObj.setValueOptBy isoSurface "colorscale" StyleParam.Colorscale.convert + ShowScale |> DynObj.setValueOpt isoSurface "showscale" + ReverseScale |> DynObj.setValueOpt isoSurface "reversescale" + CAuto |> DynObj.setValueOpt isoSurface "cauto" + CMin |> DynObj.setValueOpt isoSurface "cmin" + CMid |> DynObj.setValueOpt isoSurface "cmid" + CMax |> DynObj.setValueOpt isoSurface "cmax" + Caps |> DynObj.setValueOpt isoSurface "caps" + Contour |> DynObj.setValueOpt isoSurface "contour" + FlatShading |> DynObj.setValueOpt isoSurface "flatshading" + HoverLabel |> DynObj.setValueOpt isoSurface "hoverlabel" + IsoMax |> DynObj.setValueOpt isoSurface "isomax" + IsoMin |> DynObj.setValueOpt isoSurface "isomin" + Lighting |> DynObj.setValueOpt isoSurface "lighting" + LightPosition |> DynObj.setValueOpt isoSurface "lightposition" + OpacityScale |> DynObj.setValueOpt isoSurface "opacityscale" + Slices |> DynObj.setValueOpt isoSurface "slices" + SpaceFrame |> DynObj.setValueOpt isoSurface "spaceframe" + Surface |> DynObj.setValueOpt isoSurface "surface" + UIRevision |> DynObj.setValueOpt isoSurface "uirevision" - volume + isoSurface From d5e44685f38f3e71cf62dcd0cfd9cb9011e4c87c Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Thu, 18 Nov 2021 15:26:45 +0100 Subject: [PATCH 4/8] Update all 3D Chart constructors --- src/Plotly.NET/ChartAPI/Chart3D.fs | 421 ++++++++++++++++++----------- 1 file changed, 256 insertions(+), 165 deletions(-) diff --git a/src/Plotly.NET/ChartAPI/Chart3D.fs b/src/Plotly.NET/ChartAPI/Chart3D.fs index ae115f4af..3c76c17d1 100644 --- a/src/Plotly.NET/ChartAPI/Chart3D.fs +++ b/src/Plotly.NET/ChartAPI/Chart3D.fs @@ -468,90 +468,153 @@ module Chart3D = ) - /// Uses points, line or both depending on the mode to represent 3D-data points + /// Visualizes a 3D surface [] static member Surface ( zData, - [] ?X, - [] ?Y, - [] ?Name, - [] ?ShowLegend, - [] ?Opacity, - [] ?Contours, - [] ?ColorScale, - [] ?ShowScale, - [] ?ColorBar, - [] ?UseDefaults : bool + [] ?X : seq<#IConvertible>, + [] ?Y : seq<#IConvertible>, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?Contours : Contours, + [] ?ColorScale : StyleParam.Colorscale, + [] ?ShowScale : bool, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true Trace3D.initSurface ( Trace3DStyle.Surface( - ?X=X, - ?Y=Y, - Z=zData, - ?Contours=Contours, - ?ColorScale=ColorScale, - ?ShowScale=ShowScale, - ?ColorBar=ColorBar + Z = zData , + ?X = X , + ?Y = Y , + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?Contours = Contours , + ?ColorScale = ColorScale , + ?ShowScale = ShowScale ) ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) + |> GenericChart.ofTraceObject useDefaults - /// Uses points, line or both depending on the mode to represent 3D-data points + /// Visualizes a 3D mesh. [] static member Mesh3D ( - x, y, z, - [] ?I, - [] ?J, - [] ?K, - [] ?Name, - [] ?ShowLegend, - [] ?Opacity, - [] ?Color, - [] ?Contour, - [] ?ColorScale, - [] ?ShowScale, - [] ?ColorBar, - [] ?UseDefaults : bool + x: seq<#IConvertible>, + y: seq<#IConvertible>, + z: seq<#IConvertible>, + [] ?I : seq<#IConvertible>, + [] ?J : seq<#IConvertible>, + [] ?K : seq<#IConvertible>, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?Color : Color, + [] ?Contour : Contour, + [] ?ColorScale : StyleParam.Colorscale, + [] ?ShowScale : bool, + [] ?ColorBar : ColorBar, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true Trace3D.initMesh3D ( Trace3DStyle.Mesh3D( - X = x, - Y = y, - Z = z, - ?I = I, - ?J = J, - ?K = K, - ?Color = Color, - ?Contour = Contour, - ?ColorScale = ColorScale, - ?ShowScale = ShowScale, - ?ColorBar = ColorBar + X = x, + Y = y, + Z = z, + ?I = I , + ?J = J , + ?K = K , + ?Name = Name , + ?ShowLegend = ShowLegend, + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?Color = Color , + ?Contour = Contour , + ?ColorScale = ColorScale, + ?ShowScale = ShowScale , + ?ColorBar = ColorBar ) ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) |> GenericChart.ofTraceObject useDefaults + /// Visualizes a 3D mesh. + [] + static member Mesh3D + ( + xyz: seq<#IConvertible * #IConvertible * #IConvertible>, + [] ?I : seq<#IConvertible>, + [] ?J : seq<#IConvertible>, + [] ?K : seq<#IConvertible>, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?Color : Color, + [] ?Contour : Contour, + [] ?ColorScale : StyleParam.Colorscale, + [] ?ShowScale : bool, + [] ?ColorBar : ColorBar, + [] ?UseDefaults : bool + ) = + + let x,y,z = Seq.unzip3 xyz + + Chart.Mesh3D( + x, y, z, + ?I = I , + ?J = J , + ?K = K , + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?Color = Color , + ?Contour = Contour , + ?ColorScale = ColorScale , + ?ShowScale = ShowScale , + ?ColorBar = ColorBar , + ?UseDefaults= UseDefaults + ) + [] static member Cone ( - x, y, z, u, v, w, - [] ?Name, - [] ?ShowLegend, - [] ?Opacity, - [] ?ColorScale, - [] ?ShowScale, - [] ?ColorBar, - [] ?UseDefaults : bool + x: seq<#IConvertible>, + y: seq<#IConvertible>, + z: seq<#IConvertible>, + u: seq<#IConvertible>, + v: seq<#IConvertible>, + w: seq<#IConvertible>, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?ColorScale : StyleParam.Colorscale, + [] ?ShowScale : bool, + [] ?ColorBar : ColorBar, + [] ?SizeMode : StyleParam.ConeSizeMode, + [] ?ConeAnchor : StyleParam.ConeAnchor, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true @@ -564,28 +627,35 @@ module Chart3D = U = u, V = v, W = w, - ?Name = Name, - ?ShowLegend = ShowLegend, - ?Opacity = Opacity, - ?ColorScale = ColorScale, - ?ShowScale = ShowScale, - ?ColorBar = ColorBar + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?ColorScale = ColorScale , + ?ShowScale = ShowScale , + ?ColorBar = ColorBar , + ?SizeMode = SizeMode , + ?Anchor = ConeAnchor ) ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) |> GenericChart.ofTraceObject useDefaults [] static member Cone ( coneXYZ, coneUVW, - [] ?Name, - [] ?ShowLegend, - [] ?Opacity, - [] ?ColorScale, - [] ?ShowScale, - [] ?ColorBar, - [] ?UseDefaults : bool + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?ColorScale : StyleParam.Colorscale, + [] ?ShowScale : bool, + [] ?ColorBar : ColorBar, + [] ?SizeMode : StyleParam.ConeSizeMode, + [] ?ConeAnchor : StyleParam.ConeAnchor, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true @@ -594,13 +664,18 @@ module Chart3D = Chart.Cone( x, y, z, u, v, w, - ?Name = Name , - ?ShowLegend = ShowLegend , - ?Opacity = Opacity , - ?ColorScale = ColorScale , - ?ShowScale = ShowScale , - ?ColorBar = ColorBar , - ?UseDefaults= UseDefaults + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?ColorScale = ColorScale , + ?ShowScale = ShowScale , + ?ColorBar = ColorBar , + ?SizeMode = SizeMode , + ?ConeAnchor = ConeAnchor , + ?UseDefaults = UseDefaults + ) @@ -608,15 +683,17 @@ module Chart3D = static member StreamTube ( x, y, z, u, v, w, - [] ?Name, - [] ?ShowLegend, - [] ?Opacity, - [] ?ColorScale, - [] ?ShowScale, - [] ?ColorBar, - [] ?MaxDisplayed: int, - [] ?Starts: StreamTubeStarts, - [] ?UseDefaults : bool + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?ColorScale : StyleParam.Colorscale, + [] ?ShowScale : bool, + [] ?ColorBar : ColorBar, + [] ?MaxDisplayed : int, + [] ?TubeStarts : StreamTubeStarts, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true @@ -629,17 +706,18 @@ module Chart3D = U = u, V = v, W = w, - ?Name = Name, - ?ShowLegend = ShowLegend, - ?Opacity = Opacity, - ?ColorScale = ColorScale, - ?ShowScale = ShowScale, - ?ColorBar = ColorBar, + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?ColorScale = ColorScale , + ?ShowScale = ShowScale , + ?ColorBar = ColorBar , ?MaxDisplayed = MaxDisplayed, - ?Starts = Starts + ?Starts = TubeStarts ) ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) |> GenericChart.ofTraceObject useDefaults @@ -647,15 +725,17 @@ module Chart3D = static member StreamTube ( streamTubeXYZ, streamTubeUVW, - [] ?Name, - [] ?ShowLegend, - [] ?Opacity, - [] ?ColorScale, - [] ?ShowScale, - [] ?ColorBar, - [] ?MaxDisplayed: int, - [] ?Starts: StreamTubeStarts, - [] ?UseDefaults : bool + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?ColorScale : StyleParam.Colorscale, + [] ?ShowScale : bool, + [] ?ColorBar : ColorBar, + [] ?MaxDisplayed : int, + [] ?TubeStarts : StreamTubeStarts, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true @@ -664,15 +744,18 @@ module Chart3D = Chart.StreamTube( x, y, z, u, v, w, - ?Name = Name , - ?ShowLegend = ShowLegend , - ?Opacity = Opacity , - ?ColorScale = ColorScale , - ?ShowScale = ShowScale , - ?ColorBar = ColorBar , - ?MaxDisplayed = MaxDisplayed , - ?Starts = Starts , - ?UseDefaults = UseDefaults + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?ColorScale = ColorScale , + ?ShowScale = ShowScale , + ?ColorBar = ColorBar , + ?MaxDisplayed = MaxDisplayed, + ?TubeStarts = TubeStarts , + ?UseDefaults = UseDefaults + ) @@ -680,41 +763,45 @@ module Chart3D = static member Volume ( x,y,z,value, - [] ?Name, - [] ?ShowLegend, - [] ?Opacity, - [] ?ColorScale, - [] ?ShowScale, - [] ?ColorBar, - [] ?IsoMin, - [] ?IsoMax, - [] ?Caps : Caps, - [] ?Slices : Slices, - [] ?Surface : Surface, - [] ?UseDefaults : bool + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?ColorScale : StyleParam.Colorscale, + [] ?ShowScale : bool, + [] ?ColorBar : ColorBar, + [] ?IsoMin : float, + [] ?IsoMax : float, + [] ?Caps : Caps, + [] ?Slices : Slices, + [] ?Surface : Surface, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true Trace3D.initVolume( Trace3DStyle.Volume( - X = x, - Y = y, - Z = z, - Value = value, - ?Name = Name, - ?ShowLegend = ShowLegend, - ?Opacity = Opacity, - ?ColorScale = ColorScale, - ?ShowScale = ShowScale, - ?ColorBar = ColorBar, - ?IsoMin = IsoMin, - ?IsoMax = IsoMax, - ?Caps = Caps, - ?Slices = Slices, - ?Surface = Surface + X = x, + Y = y, + Z = z, + Value = value, + ?Name = Name , + ?ShowLegend = ShowLegend, + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?ColorScale = ColorScale, + ?ShowScale = ShowScale , + ?ColorBar = ColorBar , + ?IsoMin = IsoMin , + ?IsoMax = IsoMax , + ?Caps = Caps , + ?Slices = Slices , + ?Surface = Surface ) ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) + |> GenericChart.ofTraceObject useDefaults @@ -722,40 +809,44 @@ module Chart3D = static member IsoSurface ( x,y,z,value, - [] ?Name, - [] ?ShowLegend, - [] ?Opacity, - [] ?ColorScale, - [] ?ShowScale, - [] ?ColorBar, - [] ?IsoMin, - [] ?IsoMax, - [] ?Caps : Caps, - [] ?Slices : Slices, - [] ?Surface : Surface, - [] ?UseDefaults : bool + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Opacity : float, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?ColorScale : StyleParam.Colorscale, + [] ?ShowScale : bool, + [] ?ColorBar : ColorBar, + [] ?IsoMin : float, + [] ?IsoMax : float, + [] ?Caps : Caps, + [] ?Slices : Slices, + [] ?Surface : Surface, + [] ?UseDefaults : bool ) = let useDefaults = defaultArg UseDefaults true Trace3D.initIsoSurface( Trace3DStyle.IsoSurface( - X = x, - Y = y, - Z = z, - Value = value, - ?Name = Name, - ?ShowLegend = ShowLegend, - ?Opacity = Opacity, - ?ColorScale = ColorScale, - ?ShowScale = ShowScale, - ?ColorBar = ColorBar, - ?IsoMin = IsoMin, - ?IsoMax = IsoMax, - ?Caps = Caps, - ?Slices = Slices, - ?Surface = Surface + X = x, + Y = y, + Z = z, + Value = value, + ?Name = Name , + ?ShowLegend = ShowLegend, + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?ColorScale = ColorScale, + ?ShowScale = ShowScale , + ?ColorBar = ColorBar , + ?IsoMin = IsoMin , + ?IsoMax = IsoMax , + ?Caps = Caps , + ?Slices = Slices , + ?Surface = Surface + ) ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) |> GenericChart.ofTraceObject useDefaults \ No newline at end of file From a7e003123b2542ad01cad053934ec16a6e35a537 Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Thu, 18 Nov 2021 15:29:33 +0100 Subject: [PATCH 5/8] fix surface test --- tests/Plotly.NET.Tests/HtmlCodegen/Charts3D.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Plotly.NET.Tests/HtmlCodegen/Charts3D.fs b/tests/Plotly.NET.Tests/HtmlCodegen/Charts3D.fs index 362ea1c45..d9a363065 100644 --- a/tests/Plotly.NET.Tests/HtmlCodegen/Charts3D.fs +++ b/tests/Plotly.NET.Tests/HtmlCodegen/Charts3D.fs @@ -182,7 +182,7 @@ let ``Surface charts`` = emptyLayout firstSurfaceChart ); testCase "Second surface data" ( fun () -> - """var data = [{"type":"surface","x":[0.0,2.5],"y":[0.0,2.5],"z":[[1.0,1.0],[1.0,2.0]],"contours":{"x":{"show":true},"y":{"show":true},"z":{"show":true}},"opacity":0.5}];""" + """var data = [{"type":"surface","opacity":0.5,"x":[0.0,2.5],"y":[0.0,2.5],"z":[[1.0,1.0],[1.0,2.0]],"contours":{"x":{"show":true},"y":{"show":true},"z":{"show":true}}}];""" |> chartGeneratedContains secondSurfaceChart ); testCase "Second surface layout" ( fun () -> From 5983d6c6f6c6fcf687b0f0458da393d0172a26d8 Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Thu, 18 Nov 2021 15:44:00 +0100 Subject: [PATCH 6/8] fix streamtube docs, improve 3D docs, add flatshading to mesh constructor --- docs/03_2_3d-mesh-plots.fsx | 14 ++++-------- docs/03_4_3d-streamtube-plots.fsx | 5 ++--- docs/03_5_3d-volume-plots.fsx | 3 +-- docs/03_6_3d-isosurface-plots .fsx | 3 +-- src/Plotly.NET/ChartAPI/Chart3D.fs | 36 +++++++++++++++++------------- 5 files changed, 28 insertions(+), 33 deletions(-) diff --git a/docs/03_2_3d-mesh-plots.fsx b/docs/03_2_3d-mesh-plots.fsx index 4c80ae972..87ed39251 100644 --- a/docs/03_2_3d-mesh-plots.fsx +++ b/docs/03_2_3d-mesh-plots.fsx @@ -65,16 +65,10 @@ let c = Array.init 50 (fun _ -> rnd.NextDouble()) open Plotly.NET.TraceObjects let mesh3d = - Trace3D.initMesh3D - (fun mesh3d -> - mesh3d?x <- a - mesh3d?y <- b - mesh3d?z <- c - mesh3d?flatshading <- true - mesh3d?contour <- Contours.initXyz(Show=true) - mesh3d - ) - |> GenericChart.ofTraceObject true + Chart.Mesh3D( + a,b,c, + FlatShading = true + ) (*** condition: ipynb ***) #if IPYNB diff --git a/docs/03_4_3d-streamtube-plots.fsx b/docs/03_4_3d-streamtube-plots.fsx index 24ab555da..8e67e76a2 100644 --- a/docs/03_4_3d-streamtube-plots.fsx +++ b/docs/03_4_3d-streamtube-plots.fsx @@ -52,13 +52,12 @@ let streamTube = u = (tubeData.["u"] |> Series.values), v = (tubeData.["v"] |> Series.values), w = (tubeData.["w"] |> Series.values), - Starts = + TubeStarts = StreamTubeStarts.init( X = Array.init 16 (fun _ -> 80), Y = [20;30;40;50;20;30;40;50;20;30;40;50;20;30;40;50], Z = [0;0;0;0;5;5;5;5;10;10;10;10;15;15;15;15] - ), - ColorScale = StyleParam.Colorscale.Viridis + ) ) diff --git a/docs/03_5_3d-volume-plots.fsx b/docs/03_5_3d-volume-plots.fsx index 7f47e5462..1be5e66c8 100644 --- a/docs/03_5_3d-volume-plots.fsx +++ b/docs/03_5_3d-volume-plots.fsx @@ -70,8 +70,7 @@ let volume = Opacity=0.1, Surface=(Surface.init(Count=17)), IsoMin=0.1, - IsoMax=0.8, - ColorScale = StyleParam.Colorscale.Viridis + IsoMax=0.8 ) (*** condition: ipynb ***) diff --git a/docs/03_6_3d-isosurface-plots .fsx b/docs/03_6_3d-isosurface-plots .fsx index 75014a7a1..e4dd3dfb9 100644 --- a/docs/03_6_3d-isosurface-plots .fsx +++ b/docs/03_6_3d-isosurface-plots .fsx @@ -73,8 +73,7 @@ let isoSurface = X = (CapFill.init(Show=false)), Y = (CapFill.init(Show=false)) ), - Surface = Surface.init(Count=5), - ColorScale = StyleParam.Colorscale.Viridis + Surface = Surface.init(Count=5) ) (*** condition: ipynb ***) diff --git a/src/Plotly.NET/ChartAPI/Chart3D.fs b/src/Plotly.NET/ChartAPI/Chart3D.fs index 3c76c17d1..8a0e97808 100644 --- a/src/Plotly.NET/ChartAPI/Chart3D.fs +++ b/src/Plotly.NET/ChartAPI/Chart3D.fs @@ -527,6 +527,7 @@ module Chart3D = [] ?ColorScale : StyleParam.Colorscale, [] ?ShowScale : bool, [] ?ColorBar : ColorBar, + [] ?FlatShading : bool, [] ?UseDefaults : bool ) = @@ -534,22 +535,23 @@ module Chart3D = Trace3D.initMesh3D ( Trace3DStyle.Mesh3D( - X = x, - Y = y, - Z = z, - ?I = I , - ?J = J , - ?K = K , - ?Name = Name , - ?ShowLegend = ShowLegend, - ?Opacity = Opacity , - ?Text = Text , - ?MultiText = MultiText , - ?Color = Color , - ?Contour = Contour , - ?ColorScale = ColorScale, - ?ShowScale = ShowScale , - ?ColorBar = ColorBar + X = x, + Y = y, + Z = z, + ?I = I , + ?J = J , + ?K = K , + ?Name = Name , + ?ShowLegend = ShowLegend, + ?Opacity = Opacity , + ?Text = Text , + ?MultiText = MultiText , + ?Color = Color , + ?Contour = Contour , + ?ColorScale = ColorScale, + ?ShowScale = ShowScale , + ?ColorBar = ColorBar , + ?FlatShading = FlatShading ) ) |> GenericChart.ofTraceObject useDefaults @@ -572,6 +574,7 @@ module Chart3D = [] ?ColorScale : StyleParam.Colorscale, [] ?ShowScale : bool, [] ?ColorBar : ColorBar, + [] ?FlatShading : bool, [] ?UseDefaults : bool ) = @@ -592,6 +595,7 @@ module Chart3D = ?ColorScale = ColorScale , ?ShowScale = ShowScale , ?ColorBar = ColorBar , + ?FlatShading= FlatShading, ?UseDefaults= UseDefaults ) From f7e9ba24270ab623e7541c1a85f4b087a6444e80 Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Thu, 18 Nov 2021 15:55:39 +0100 Subject: [PATCH 7/8] fix colorbar styling --- .../ObjectAbstractions/Common/ColorBar.fs | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/Plotly.NET/Layout/ObjectAbstractions/Common/ColorBar.fs b/src/Plotly.NET/Layout/ObjectAbstractions/Common/ColorBar.fs index f6512e641..b95aab558 100644 --- a/src/Plotly.NET/Layout/ObjectAbstractions/Common/ColorBar.fs +++ b/src/Plotly.NET/Layout/ObjectAbstractions/Common/ColorBar.fs @@ -237,47 +237,47 @@ type ColorBar () = (fun (colorBar:ColorBar) -> - BGColor |> DynObj.setValueOpt colorBar "bgcolor" - BorderColor |> DynObj.setValueOpt colorBar "bordercolor" - BorderWidth |> DynObj.setValueOpt colorBar "borderwidth" - DTick |> DynObj.setValueOpt colorBar "dtick" - ExponentFormat |> DynObj.setValueOpt colorBar "exponentformat" - Len |> DynObj.setValueOpt colorBar "len" - LenMode |> DynObj.setValueOpt colorBar "lenmode" - MinExponent |> DynObj.setValueOpt colorBar "min3xponent" - NTicks |> DynObj.setValueOpt colorBar "nticks" - OutlineColor |> DynObj.setValueOpt colorBar "outlinecolor" - OutlineWidth |> DynObj.setValueOpt colorBar "outlinewidth" - SeparateThousands |> DynObj.setValueOpt colorBar "separatethousands" - ShowExponent |> DynObj.setValueOpt colorBar "showexponent" - ShowTickLabels |> DynObj.setValueOpt colorBar "showticklabels" - ShowTickPrefix |> DynObj.setValueOpt colorBar "showtickprefix" - ShowTickSuffix |> DynObj.setValueOpt colorBar "showticksuffix" - Thickness |> DynObj.setValueOpt colorBar "thickness" - ThicknessMode |> DynObj.setValueOpt colorBar "thicknessmode" - Tick0 |> DynObj.setValueOpt colorBar "tick0" - TickAngle |> DynObj.setValueOpt colorBar "tickangle" - TickColor |> DynObj.setValueOpt colorBar "tickcolor" - TickFont |> DynObj.setValueOpt colorBar "tickfont" - TickFormat |> DynObj.setValueOpt colorBar "tickformat" - TickFormatStops |> DynObj.setValueOpt colorBar "tickformatstops" - TickLabelOverflow |> DynObj.setValueOpt colorBar "ticklabeloverflow" - TickLabelPosition |> DynObj.setValueOpt colorBar "ticklabelposition" - TickLen |> DynObj.setValueOpt colorBar "ticklen" - TickMode |> DynObj.setValueOpt colorBar "tickmode" - TickPrefix |> DynObj.setValueOpt colorBar "tickprefix" - Ticks |> DynObj.setValueOpt colorBar "ticks" - TickSuffix |> DynObj.setValueOpt colorBar "ticksuffix" - TickText |> DynObj.setValueOpt colorBar "ticktext" - TickVals |> DynObj.setValueOpt colorBar "tickvals" - TickWidth |> DynObj.setValueOpt colorBar "tickwidth" - Title |> DynObj.setValueOpt colorBar "title" - X |> DynObj.setValueOpt colorBar "x" - XAnchor |> DynObj.setValueOpt colorBar "xanchor" - XPad |> DynObj.setValueOpt colorBar "xpad" - Y |> DynObj.setValueOpt colorBar "y" - YAnchor |> DynObj.setValueOpt colorBar "yanchor" - YPad |> DynObj.setValueOpt colorBar "ypad" + BGColor |> DynObj.setValueOpt colorBar "bgcolor" + BorderColor |> DynObj.setValueOpt colorBar "bordercolor" + BorderWidth |> DynObj.setValueOpt colorBar "borderwidth" + DTick |> DynObj.setValueOpt colorBar "dtick" + ExponentFormat |> DynObj.setValueOptBy colorBar "exponentformat" StyleParam.ExponentFormat.convert + Len |> DynObj.setValueOpt colorBar "len" + LenMode |> DynObj.setValueOptBy colorBar "lenmode" StyleParam.UnitMode.convert + MinExponent |> DynObj.setValueOpt colorBar "min3xponent" + NTicks |> DynObj.setValueOpt colorBar "nticks" + OutlineColor |> DynObj.setValueOpt colorBar "outlinecolor" + OutlineWidth |> DynObj.setValueOpt colorBar "outlinewidth" + SeparateThousands |> DynObj.setValueOpt colorBar "separatethousands" + ShowExponent |> DynObj.setValueOptBy colorBar "showexponent" StyleParam.ShowExponent.convert + ShowTickLabels |> DynObj.setValueOpt colorBar "showticklabels" + ShowTickPrefix |> DynObj.setValueOptBy colorBar "showtickprefix" StyleParam.ShowTickOption.convert + ShowTickSuffix |> DynObj.setValueOptBy colorBar "showticksuffix" StyleParam.ShowTickOption.convert + Thickness |> DynObj.setValueOpt colorBar "thickness" + ThicknessMode |> DynObj.setValueOptBy colorBar "thicknessmode" StyleParam.UnitMode.convert + Tick0 |> DynObj.setValueOpt colorBar "tick0" + TickAngle |> DynObj.setValueOpt colorBar "tickangle" + TickColor |> DynObj.setValueOpt colorBar "tickcolor" + TickFont |> DynObj.setValueOpt colorBar "tickfont" + TickFormat |> DynObj.setValueOpt colorBar "tickformat" + TickFormatStops |> DynObj.setValueOpt colorBar "tickformatstops" + TickLabelOverflow |> DynObj.setValueOptBy colorBar "ticklabeloverflow" StyleParam.TickLabelOverflow.convert + TickLabelPosition |> DynObj.setValueOptBy colorBar "ticklabelposition" StyleParam.TickLabelPosition.convert + TickLen |> DynObj.setValueOpt colorBar "ticklen" + TickMode |> DynObj.setValueOptBy colorBar "tickmode" StyleParam.TickMode.convert + TickPrefix |> DynObj.setValueOpt colorBar "tickprefix" + Ticks |> DynObj.setValueOptBy colorBar "ticks" StyleParam.TickOptions.convert + TickSuffix |> DynObj.setValueOpt colorBar "ticksuffix" + TickText |> DynObj.setValueOpt colorBar "ticktext" + TickVals |> DynObj.setValueOpt colorBar "tickvals" + TickWidth |> DynObj.setValueOpt colorBar "tickwidth" + Title |> DynObj.setValueOpt colorBar "title" + X |> DynObj.setValueOpt colorBar "x" + XAnchor |> DynObj.setValueOptBy colorBar "xanchor" StyleParam.HorizontalAlign.convert + XPad |> DynObj.setValueOpt colorBar "xpad" + Y |> DynObj.setValueOpt colorBar "y" + YAnchor |> DynObj.setValueOptBy colorBar "yanchor" StyleParam.VerticalAlign.convert + YPad |> DynObj.setValueOpt colorBar "ypad" colorBar ) From d6840769b21950f95f0fe9cb7adf4622993fa5c6 Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Thu, 18 Nov 2021 16:03:35 +0100 Subject: [PATCH 8/8] Add camera object abstraction --- .../CommonAbstractions/StyleParams.fs | 13 ++ .../Layout/ObjectAbstractions/3D/Camera.fs | 134 ++++++++++++++++++ src/Plotly.NET/Playground.fsx | 59 ++++++++ 3 files changed, 206 insertions(+) diff --git a/src/Plotly.NET/CommonAbstractions/StyleParams.fs b/src/Plotly.NET/CommonAbstractions/StyleParams.fs index e0f074202..260a3745e 100644 --- a/src/Plotly.NET/CommonAbstractions/StyleParams.fs +++ b/src/Plotly.NET/CommonAbstractions/StyleParams.fs @@ -366,6 +366,19 @@ module StyleParam = override this.ToString() = this |> ConstraintOperation.toString member this.Convert() = this |> ConstraintOperation.convert + [] + type CameraProjection = + | Perspective + | Orthographic + + static member toString = function + | Perspective -> "perspective" + | Orthographic -> "orthographic" + + static member convert = CameraProjection.toString >> box + override this.ToString() = this |> CameraProjection.toString + member this.Convert() = this |> CameraProjection.convert + [] type ContourType = | Levels diff --git a/src/Plotly.NET/Layout/ObjectAbstractions/3D/Camera.fs b/src/Plotly.NET/Layout/ObjectAbstractions/3D/Camera.fs index f6f86d5fe..e831ed687 100644 --- a/src/Plotly.NET/Layout/ObjectAbstractions/3D/Camera.fs +++ b/src/Plotly.NET/Layout/ObjectAbstractions/3D/Camera.fs @@ -5,5 +5,139 @@ open DynamicObj open System open System.Runtime.InteropServices + + +type CameraCenter() = + inherit DynamicObj () + + static member init + ( + [] ?X: float, + [] ?Y: float, + [] ?Z: float + + + ) = + CameraCenter() + |> CameraCenter.style ( + ?X = X, + ?Y = Y, + ?Z = Z + ) + + static member style + ( + [] ?X: float, + [] ?Y: float, + [] ?Z: float + ) = + + fun (cameraCenter: CameraCenter) -> + + X |> DynObj.setValueOpt cameraCenter "x" + Y |> DynObj.setValueOpt cameraCenter "y" + Z |> DynObj.setValueOpt cameraCenter "z" + + cameraCenter + +type CameraEye() = + inherit DynamicObj () + + static member init + ( + [] ?X: float, + [] ?Y: float, + [] ?Z: float + + + ) = + CameraEye() + |> CameraEye.style ( + ?X = X, + ?Y = Y, + ?Z = Z + ) + + static member style + ( + [] ?X: float, + [] ?Y: float, + [] ?Z: float + ) = + + fun (cameraEye: CameraEye) -> + + X |> DynObj.setValueOpt cameraEye "x" + Y |> DynObj.setValueOpt cameraEye "y" + Z |> DynObj.setValueOpt cameraEye "z" + + cameraEye + +type CameraUp() = + inherit DynamicObj () + + static member init + ( + [] ?X: float, + [] ?Y: float, + [] ?Z: float + + + ) = + CameraUp() + |> CameraUp.style ( + ?X = X, + ?Y = Y, + ?Z = Z + ) + + static member style + ( + [] ?X: float, + [] ?Y: float, + [] ?Z: float + ) = + + fun (cameraUp: CameraUp) -> + + X |> DynObj.setValueOpt cameraUp "x" + Y |> DynObj.setValueOpt cameraUp "y" + Z |> DynObj.setValueOpt cameraUp "z" + + cameraUp + type Camera() = inherit DynamicObj () + + static member init + ( + [] ?Center : CameraCenter, + [] ?Eye : CameraEye, + [] ?Projection : StyleParam.CameraProjection, + [] ?Up : CameraUp + + ) = + Camera() + |> Camera.style ( + ?Center = Center , + ?Eye = Eye , + ?Projection = Projection, + ?Up = Up + ) + + static member style + ( + [] ?Center : CameraCenter, + [] ?Eye : CameraEye, + [] ?Projection : StyleParam.CameraProjection, + [] ?Up : CameraUp + ) = + + fun (camera: Camera) -> + + Center |> DynObj.setValueOpt camera "center" + Eye |> DynObj.setValueOpt camera "eye" + Projection |> DynObj.setValueOptBy camera "projection" StyleParam.CameraProjection.convert + Up |> DynObj.setValueOpt camera "up" + + camera \ No newline at end of file diff --git a/src/Plotly.NET/Playground.fsx b/src/Plotly.NET/Playground.fsx index 4cbed7fad..f2ab7ee1b 100644 --- a/src/Plotly.NET/Playground.fsx +++ b/src/Plotly.NET/Playground.fsx @@ -183,6 +183,65 @@ open Plotly.NET open FSharp.Data open Deedle +//---------------------- Generate linearly spaced vector ---------------------- +let linspace (min,max,n) = + if n <= 2 then failwithf "n needs to be larger then 2" + let bw = float (max - min) / (float n - 1.) + Array.init n (fun i -> min + (bw * float i)) + //[|min ..bw ..max|] + +//---------------------- Create example data ---------------------- +let size = 100 +let x = linspace(-2. * Math.PI, 2. * Math.PI, size) +let y = linspace(-2. * Math.PI, 2. * Math.PI, size) + +let f x y = - (5. * x / (x**2. + y**2. + 1.) ) + +let z = + Array.init size (fun i -> + Array.init size (fun j -> + f x.[j] y.[i] + ) + ) + +let rnd = System.Random() +let a = Array.init 50 (fun _ -> rnd.NextDouble()) +let b = Array.init 50 (fun _ -> rnd.NextDouble()) +let c = Array.init 50 (fun _ -> rnd.NextDouble()) + +open Plotly.NET.TraceObjects + +[ + Chart.Line3D( + [1,2,3; 4,5,6], + UseDefaults = false + ) + + + Chart.Line3D( + [1,2,3; 4,5,6], + UseDefaults = false + ) + +] +|> Chart.Grid(2,1) +|> Chart.withScene( + Scene.init( + Camera = Camera.init( + Projection = StyleParam.CameraProjection.Perspective + ) + ), StyleParam.SubPlotId.Scene 1 +) +|> Chart.withScene( + Scene.init( + Camera = Camera.init( + Projection = StyleParam.CameraProjection.Orthographic + ) + ), StyleParam.SubPlotId.Scene 2 +) +|> Chart.withSize (1000,1000) +|> Chart.show + Chart.Bubble3D( [for i in 0..10 do yield (i,i,i)], [0 .. 10 .. 100],