From a0323bc4a8b3f1066ef69707cb585f34e63af094 Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Thu, 11 Nov 2021 14:49:35 +0100 Subject: [PATCH 1/8] Implement Global Defaults, add plotly template --- global.json | 2 +- src/Plotly.NET/ChartAPI/Chart.fs | 9 +- src/Plotly.NET/ChartAPI/Chart2D.fs | 560 ++++++++----- src/Plotly.NET/ChartAPI/Chart3D.fs | 192 +++-- src/Plotly.NET/ChartAPI/ChartCarpet.fs | 114 ++- src/Plotly.NET/ChartAPI/ChartDomain.fs | 348 ++++---- src/Plotly.NET/ChartAPI/ChartMap.fs | 792 ++++++++++-------- src/Plotly.NET/ChartAPI/ChartPolar.fs | 146 ++-- src/Plotly.NET/ChartAPI/ChartTernary.fs | 53 +- src/Plotly.NET/ChartAPI/GenericChart.fs | 60 +- src/Plotly.NET/CommonAbstractions/Title.fs | 20 +- src/Plotly.NET/Extensions/SankeyExtension.fs | 35 +- .../ObjectAbstractions/Common/LinearAxis.fs | 18 +- .../ObjectAbstractions/Ternary/Ternary.fs | 26 +- src/Plotly.NET/Playground.fsx | 13 +- src/Plotly.NET/Plotly.NET.fsproj | 8 +- src/Plotly.NET/Templates/Defaults.fs | 20 + src/Plotly.NET/Templates/PlotlyTheme.fs | 199 +++++ .../{Template => Templates}/Template.fs | 0 19 files changed, 1659 insertions(+), 956 deletions(-) create mode 100644 src/Plotly.NET/Templates/Defaults.fs create mode 100644 src/Plotly.NET/Templates/PlotlyTheme.fs rename src/Plotly.NET/{Template => Templates}/Template.fs (100%) diff --git a/global.json b/global.json index 2ad4d9100..572f5a420 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { "version": "5.0.100", - "rollForward": "latestFeature" + "rollForward": "latestMajor" } } \ No newline at end of file diff --git a/src/Plotly.NET/ChartAPI/Chart.fs b/src/Plotly.NET/ChartAPI/Chart.fs index 0db04df8e..0b1860878 100644 --- a/src/Plotly.NET/ChartAPI/Chart.fs +++ b/src/Plotly.NET/ChartAPI/Chart.fs @@ -59,7 +59,7 @@ type Chart = let trace = Trace2D.initScatter(id) trace.Remove("type") |> ignore - GenericChart.ofTraceObject trace + GenericChart.ofTraceObject false trace |> GenericChart.mapLayout ( fun l -> l |> Layout.AddLinearAxis(StyleParam.SubPlotId.XAxis 1,hiddenAxis()) @@ -976,10 +976,9 @@ type Chart = static member withTemplate(template: Template) = (fun (ch:GenericChart) -> ch - |> GenericChart.mapLayout (fun l -> - template |> DynObj.setValue l "template" - l - ) + |> GenericChart.mapLayout ( + Layout.style(Template = (template :> DynamicObj)) + ) ) // TODO: Include withLegend & withLegendStyle diff --git a/src/Plotly.NET/ChartAPI/Chart2D.fs b/src/Plotly.NET/ChartAPI/Chart2D.fs index 5445e796f..b47bc1cd1 100644 --- a/src/Plotly.NET/ChartAPI/Chart2D.fs +++ b/src/Plotly.NET/ChartAPI/Chart2D.fs @@ -16,21 +16,21 @@ module Chart2D = [] type Chart = [] - static member internal renderScatterTrace (useWebGL:bool) (style: Trace2D -> Trace2D) = + static member internal renderScatterTrace (useDefaults:bool) (useWebGL:bool) (style: Trace2D -> Trace2D) = if useWebGL then Trace2D.initScatterGL style - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults else Trace2D.initScatter style - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults [] - static member internal renderHeatmapTrace (useWebGL:bool) (style: Trace2D -> Trace2D) = + static member internal renderHeatmapTrace (useDefaults:bool) (useWebGL:bool) (style: Trace2D -> Trace2D) = if useWebGL then Trace2D.initHeatmapGL style - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults else Trace2D.initHeatmap style - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Creates a Scatter chart. Scatter charts are the basis of Point, Line, and Bubble Charts in Plotly, and can be customized as such. We also provide abstractions for those: Chart.Line, Chart.Point, Chart.Bubble /// Sets the x coordinates of the plotted data. @@ -51,7 +51,9 @@ module Chart2D = /// Sets the normalization for the sum of this `stackgroup. Only relevant when `stackgroup` is used, and only the first `groupnorm` found in the `stackgroup` will be used /// If true, plotly.js will use the WebGL engine to render this chart. use this when you want to render many objects at once. [] - static member Scatter(x, y, mode, + static member Scatter + ( + x, y, mode, [] ?Name , [] ?ShowLegend , [] ?MarkerSymbol , @@ -65,9 +67,12 @@ module Chart2D = [] ?StackGroup , [] ?Orientation , [] ?GroupNorm , - []?UseWebGL : bool + []?UseWebGL : bool, + [] ?UseDefaults : bool ) = + let useDefaults = defaultArg UseDefaults true + let style = Trace2DStyle.Scatter( X = x , @@ -84,7 +89,7 @@ module Chart2D = let useWebGL = defaultArg UseWebGL false - Chart.renderScatterTrace useWebGL style + Chart.renderScatterTrace useDefaults useWebGL style /// Creates a Scatter chart. Scatter charts are the basis of Point, Line, and Bubble Charts in Plotly, and can be customized as such. We also provide abstractions for those: Chart.Line, Chart.Point, Chart.Bubble @@ -119,7 +124,10 @@ module Chart2D = [] ?StackGroup , [] ?Orientation , [] ?GroupNorm , - []?UseWebGL : bool) = + []?UseWebGL : bool, + [] ?UseDefaults : bool + ) = + let x,y = Seq.unzip xy Chart.Scatter(x, y, mode, ?Name = Name , @@ -135,7 +143,8 @@ module Chart2D = ?StackGroup = StackGroup , ?Orientation = Orientation , ?GroupNorm = GroupNorm , - ?UseWebGL = UseWebGL + ?UseWebGL = UseWebGL , + ?UseDefaults = UseDefaults ) @@ -168,8 +177,11 @@ module Chart2D = [] ?StackGroup , [] ?Orientation , [] ?GroupNorm , - []?UseWebGL : bool + []?UseWebGL : bool, + [] ?UseDefaults : bool ) = + + let useDefaults = defaultArg UseDefaults true // if text position or font is set, then show labels (not only when hovering) let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) let useWebGL = defaultArg UseWebGL false @@ -186,7 +198,7 @@ module Chart2D = >> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) >> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - Chart.renderScatterTrace useWebGL style + Chart.renderScatterTrace useDefaults useWebGL style /// Creates a Point chart, which uses Points in a 2D space to visualize data. /// Sets the x,y coordinates of the plotted data. @@ -215,7 +227,8 @@ module Chart2D = [] ?StackGroup , [] ?Orientation , [] ?GroupNorm , - []?UseWebGL : bool + []?UseWebGL : bool, + []?UseDefaults : bool ) = let x,y = Seq.unzip xy Chart.Point(x, y, @@ -230,7 +243,8 @@ module Chart2D = ?StackGroup = StackGroup, ?Orientation = Orientation, ?GroupNorm = GroupNorm, - ?UseWebGL = UseWebGL + ?UseWebGL = UseWebGL , + ?UseDefaults = UseDefaults ) @@ -268,8 +282,12 @@ module Chart2D = [] ?StackGroup , [] ?Orientation , [] ?GroupNorm , - []?UseWebGL : bool + []?UseWebGL : bool, + [] ?UseDefaults : bool ) = + + let useDefaults = defaultArg UseDefaults true + // if text position or font is set than show labels (not only when hovering) let changeMode = let isShowMarker = @@ -295,7 +313,7 @@ module Chart2D = let useWebGL = defaultArg UseWebGL false - Chart.renderScatterTrace useWebGL style + Chart.renderScatterTrace useDefaults useWebGL style /// Creates a Line chart, which uses a Line plotted between the given datums in a 2D space to visualize typically an evolution of Y depending on X. @@ -331,7 +349,8 @@ module Chart2D = [] ?StackGroup , [] ?Orientation , [] ?GroupNorm , - []?UseWebGL : bool + []?UseWebGL : bool, + []?UseDefaults : bool ) = let x,y = Seq.unzip xy Chart.Line( @@ -350,7 +369,8 @@ module Chart2D = ?StackGroup = StackGroup, ?Orientation = Orientation, ?GroupNorm = GroupNorm, - ?UseWebGL = UseWebGL + ?UseWebGL = UseWebGL, + ?UseDefaults = UseDefaults ) @@ -391,9 +411,12 @@ module Chart2D = [] ?StackGroup , [] ?Orientation , [] ?GroupNorm , - []?UseWebGL : bool + []?UseWebGL : bool, + [] ?UseDefaults : bool ) = + let useDefaults = defaultArg UseDefaults true + let changeMode = let isShowMarker = match ShowMarkers with @@ -416,7 +439,7 @@ module Chart2D = >> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) let useWebGL = defaultArg UseWebGL false - Chart.renderScatterTrace useWebGL style + Chart.renderScatterTrace useDefaults useWebGL style /// Creates a Spline chart. A spline chart is a line chart in which data points are connected by smoothed curves: this modification is aimed to improve the design of a chart. @@ -455,7 +478,8 @@ module Chart2D = [] ?StackGroup , [] ?Orientation , [] ?GroupNorm , - []?UseWebGL : bool + []?UseWebGL : bool, + []?UseDefaults : bool ) = let x,y = Seq.unzip xy Chart.Spline(x, y, @@ -474,7 +498,8 @@ module Chart2D = ?StackGroup = StackGroup, ?Orientation = Orientation, ?GroupNorm = GroupNorm, - ?UseWebGL = UseWebGL + ?UseWebGL = UseWebGL, + ?UseDefaults = UseDefaults ) @@ -507,8 +532,11 @@ module Chart2D = [] ?StackGroup , [] ?Orientation , [] ?GroupNorm , - []?UseWebGL : bool + []?UseWebGL : bool, + [] ?UseDefaults : bool ) = + + let useDefaults = defaultArg UseDefaults true // if text position or font is set than show labels (not only when hovering) let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) @@ -525,7 +553,7 @@ module Chart2D = >> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) let useWebGL = defaultArg UseWebGL false - Chart.renderScatterTrace useWebGL style + Chart.renderScatterTrace useDefaults useWebGL style /// Creates a bubble chart. A bubble chart is a variation of the Point chart, where the data points get an additional scale by being rendered as bubbles of different sizes. /// Sets the x coordinates, y coordinates, and bubble sizes of the plotted data. @@ -553,7 +581,8 @@ module Chart2D = [] ?StackGroup , [] ?Orientation , [] ?GroupNorm , - []?UseWebGL : bool + []?UseWebGL : bool, + []?UseDefaults : bool ) = let x,y,sizes = Seq.unzip3 xysizes Chart.Bubble( @@ -569,7 +598,8 @@ module Chart2D = ?StackGroup = StackGroup, ?Orientation = Orientation, ?GroupNorm = GroupNorm, - ?UseWebGL = UseWebGL + ?UseWebGL = UseWebGL , + ?UseDefaults = UseDefaults ) /// Displays a range of data by plotting two Y values per data point, with each Y value being drawn as a line @@ -586,7 +616,11 @@ module Chart2D = [] ?TextPosition, [] ?TextFont, [] ?LowerName: string, - [] ?UpperName: string) = + [] ?UpperName: string, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let upperName = defaultArg UpperName "upper" let lowerName = defaultArg LowerName "lower" @@ -624,7 +658,7 @@ module Chart2D = |> TraceStyle.Marker(Color=if RangeColor.IsSome then RangeColor.Value else (Plotly.NET.Color.fromString "rgba(0,0,0,0.5)")) |> TraceStyle.TextLabel(?Text=UpperLabels,?Textposition=TextPosition,?Textfont=TextFont) - GenericChart.MultiChart ([lower;upper;trace],Layout(),Config(), DisplayOptions()) + GenericChart.ofTraceObjects useDefaults [lower;upper;trace] /// Displays a range of data by plotting two Y values per data point, with each Y value being drawn as a line [] @@ -640,9 +674,26 @@ module Chart2D = [] ?TextPosition, [] ?TextFont, [] ?LowerName, - [] ?UpperName) = + [] ?UpperName, + [] ?UseDefaults:bool + ) = let x,y = Seq.unzip xy - Chart.Range(x, y, upper, lower, mode, ?Name=Name,?ShowMarkers=ShowMarkers,?ShowLegend=ShowLegend,?Color=Color,?RangeColor=RangeColor,?Labels=Labels,?UpperLabels=UpperLabels,?LowerLabels=LowerLabels,?TextPosition=TextPosition,?TextFont=TextFont,?LowerName=LowerName,?UpperName=UpperName) + Chart.Range( + x, y, upper, lower, mode, + ?Name=Name, + ?ShowMarkers=ShowMarkers, + ?ShowLegend=ShowLegend, + ?Color=Color, + ?RangeColor=RangeColor, + ?Labels=Labels, + ?UpperLabels=UpperLabels, + ?LowerLabels=LowerLabels, + ?TextPosition=TextPosition, + ?TextFont=TextFont, + ?LowerName=LowerName, + ?UpperName=UpperName, + ?UseDefaults = UseDefaults + ) /// Emphasizes the degree of change over time and shows the relationship of the parts to a whole. @@ -658,7 +709,11 @@ module Chart2D = [] ?TextPosition, [] ?TextFont, [] ?Dash, - [] ?Width) = + [] ?Width, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true // if text position or font is set than show labels (not only when hovering) let changeMode = let isShowMarker = @@ -674,7 +729,7 @@ module Chart2D = |> TraceStyle.Line(?Color=Color,?Dash=Dash,?Width=Width) |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Emphasizes the degree of change over time and shows the relationship of the parts to a whole. @@ -690,9 +745,12 @@ module Chart2D = [] ?TextPosition, [] ?TextFont, [] ?Dash, - [] ?Width) = + [] ?Width, + [] ?UseDefaults : bool + ) = + let x,y = Seq.unzip xy - Chart.Area(x, y, ?Name=Name,?ShowMarkers=ShowMarkers,?ShowLegend=ShowLegend,?MarkerSymbol=MarkerSymbol,?Color=Color,?Opacity=Opacity,?Labels=Labels,?TextPosition=TextPosition,?TextFont=TextFont,?Dash=Dash,?Width=Width) + Chart.Area(x, y, ?Name=Name,?ShowMarkers=ShowMarkers,?ShowLegend=ShowLegend,?MarkerSymbol=MarkerSymbol,?Color=Color,?Opacity=Opacity,?Labels=Labels,?TextPosition=TextPosition,?TextFont=TextFont,?Dash=Dash,?Width=Width, ?UseDefaults=UseDefaults) /// Emphasizes the degree of change over time and shows the relationship of the parts to a whole. @@ -709,7 +767,11 @@ module Chart2D = [] ?TextFont, [] ?Dash, [] ?Width, - [] ?Smoothing) = + [] ?Smoothing, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true // if text position or font is set than show labels (not only when hovering) let changeMode = let isShowMarker = @@ -725,8 +787,7 @@ module Chart2D = |> TraceStyle.Line(?Color=Color,?Dash=Dash,?Width=Width, Shape=StyleParam.Shape.Spline, ?Smoothing=Smoothing) |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject - + |> GenericChart.ofTraceObject useDefaults /// Emphasizes the degree of change over time and shows the relationship of the parts to a whole. [] @@ -742,9 +803,12 @@ module Chart2D = [] ?TextFont, [] ?Dash, [] ?Width, - [] ?Smoothing) = + [] ?Smoothing, + [] ?UseDefaults : bool + ) = + let x,y = Seq.unzip xy - Chart.SplineArea(x, y, ?Name=Name,?ShowMarkers=ShowMarkers,?ShowLegend=ShowLegend,?MarkerSymbol=MarkerSymbol,?Color=Color,?Opacity=Opacity,?Labels=Labels,?TextPosition=TextPosition,?TextFont=TextFont,?Dash=Dash,?Width=Width,?Smoothing=Smoothing) + Chart.SplineArea(x, y, ?Name=Name,?ShowMarkers=ShowMarkers,?ShowLegend=ShowLegend,?MarkerSymbol=MarkerSymbol,?Color=Color,?Opacity=Opacity,?Labels=Labels,?TextPosition=TextPosition,?TextFont=TextFont,?Dash=Dash,?Width=Width,?Smoothing=Smoothing,?UseDefaults = UseDefaults) /// Emphasizes the degree of change over time and shows the relationship of the parts to a whole. [] @@ -758,7 +822,11 @@ module Chart2D = [] ?TextPosition, [] ?TextFont, [] ?Dash, - [] ?Width) = + [] ?Width, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true Trace2D.initScatter ( Trace2DStyle.Scatter(X = x,Y = y, Mode=StyleParam.Mode.Lines) ) |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) @@ -766,7 +834,7 @@ module Chart2D = |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) |> TraceStyle.SetStackGroup "static" - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Emphasizes the degree of change over time and shows the relationship of the parts to a whole. [] @@ -780,9 +848,12 @@ module Chart2D = [] ?TextPosition, [] ?TextFont, [] ?Dash, - [] ?Width) = + [] ?Width, + [] ?UseDefaults : bool + ) = + let x,y = Seq.unzip xy - Chart.StackedArea(x, y, ?Name=Name,?ShowLegend=ShowLegend,?MarkerSymbol=MarkerSymbol,?Color=Color,?Opacity=Opacity,?Labels=Labels,?TextPosition=TextPosition,?TextFont=TextFont,?Dash=Dash,?Width=Width) + Chart.StackedArea(x, y, ?Name=Name,?ShowLegend=ShowLegend,?MarkerSymbol=MarkerSymbol,?Color=Color,?Opacity=Opacity,?Labels=Labels,?TextPosition=TextPosition,?TextFont=TextFont,?Dash=Dash,?Width=Width, ?UseDefaults = UseDefaults) /// Creates a Funnel chart. @@ -836,7 +907,9 @@ module Chart2D = /// /// Outsidetextfont: Sets the font used for `text` lying outside the bar. [] - static member Funnel (x, y, + static member Funnel + ( + x, y, [] ?Name , [] ?ShowLegend , [] ?Opacity , @@ -857,9 +930,12 @@ module Chart2D = [] ?Cliponaxis , [] ?Connector , [] ?Insidetextfont , - [] ?Outsidetextfont + [] ?Outsidetextfont, + [] ?UseDefaults : bool ) = + let useDefaults = defaultArg UseDefaults true + Trace2D.initFunnel( Trace2DStyle.Funnel( x = x , @@ -882,7 +958,7 @@ module Chart2D = |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) |> TraceStyle.Marker(?Color=Color,?Outline=Line) |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Creates a waterfall chart. Waterfall charts are special bar charts that help visualizing the cumulative effect of sequentially introduced positive or negative values /// @@ -919,8 +995,12 @@ module Chart2D = []?Connector : WaterfallConnector , []?AlignmentGroup : string, []?OffsetGroup : string, - []?Offset - ) = + []?Offset, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + Trace2D.initWaterfall( Trace2DStyle.Waterfall(x,y, ?Base = Base , @@ -933,7 +1013,7 @@ module Chart2D = ?Offset = Offset ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Creates a waterfall chart. Waterfall charts are special bar charts that help visualizing the cumulative effect of sequentially introduced positive or negative values @@ -965,8 +1045,12 @@ module Chart2D = []?Connector : WaterfallConnector , []?AlignmentGroup : string, []?OffsetGroup : string, - []?Offset - ) = + []?Offset, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + let x,y,measure = Seq.unzip3 xyMeasure Trace2D.initWaterfall( Trace2DStyle.Waterfall(x,y, @@ -980,7 +1064,7 @@ module Chart2D = ?Offset = Offset ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Illustrates comparisons among individual items [] @@ -1004,9 +1088,12 @@ module Chart2D = [] ?TextPosition : StyleParam.TextPosition, [] ?MultiTextPosition : seq, [] ?TextFont : Font, - [] ?Marker : Marker + [] ?Marker : Marker, + [] ?UseDefaults : bool ) = + let useDefaults = defaultArg UseDefaults true + let pattern = Pattern |> Option.defaultValue (TraceObjects.Pattern.init()) @@ -1043,7 +1130,7 @@ module Chart2D = Marker = marker ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Illustrates comparisons among individual items [] @@ -1066,8 +1153,10 @@ module Chart2D = [] ?TextPosition : StyleParam.TextPosition, [] ?MultiTextPosition : seq, [] ?TextFont : Font, - [] ?Marker : Marker + [] ?Marker : Marker, + [] ?UseDefaults : bool ) = + let keys,values = Seq.unzip keysValues Chart.Bar( values, @@ -1088,7 +1177,8 @@ module Chart2D = ?TextPosition = TextPosition , ?MultiTextPosition = MultiTextPosition, ?TextFont = TextFont , - ?Marker = Marker + ?Marker = Marker , + ?UseDefaults = UseDefaults ) @@ -1114,9 +1204,9 @@ module Chart2D = [] ?TextPosition : StyleParam.TextPosition, [] ?MultiTextPosition : seq, [] ?TextFont : Font, - [] ?Marker : Marker - - ) = + [] ?Marker : Marker, + [] ?UseDefaults : bool + ) = Chart.Bar( values, @@ -1137,7 +1227,8 @@ module Chart2D = ?TextPosition = TextPosition , ?MultiTextPosition = MultiTextPosition, ?TextFont = TextFont , - ?Marker = Marker + ?Marker = Marker , + ?UseDefaults = UseDefaults ) |> GenericChart.mapLayout (Layout.style (BarMode=StyleParam.BarMode.Stack)) @@ -1163,9 +1254,10 @@ module Chart2D = [] ?TextPosition : StyleParam.TextPosition, [] ?MultiTextPosition : seq, [] ?TextFont : Font, - [] ?Marker : Marker + [] ?Marker : Marker, + [] ?UseDefaults : bool ) = - + let keys,values = Seq.unzip keysValues Chart.StackedBar( values, @@ -1186,7 +1278,8 @@ module Chart2D = ?TextPosition = TextPosition , ?MultiTextPosition = MultiTextPosition, ?TextFont = TextFont , - ?Marker = Marker + ?Marker = Marker , + ?UseDefaults = UseDefaults ) /// Illustrates comparisons among individual items @@ -1211,9 +1304,12 @@ module Chart2D = [] ?TextPosition : StyleParam.TextPosition, [] ?MultiTextPosition : seq, [] ?TextFont : Font, - [] ?Marker : Marker + [] ?Marker : Marker, + [] ?UseDefaults : bool ) = + let useDefaults = defaultArg UseDefaults true + let pattern = Pattern |> Option.defaultValue (TraceObjects.Pattern.init()) @@ -1249,7 +1345,7 @@ module Chart2D = Marker = marker ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Illustrates comparisons among individual items [] @@ -1272,8 +1368,10 @@ module Chart2D = [] ?TextPosition : StyleParam.TextPosition, [] ?MultiTextPosition : seq, [] ?TextFont : Font, - [] ?Marker : Marker + [] ?Marker : Marker, + [] ?UseDefaults : bool ) = + let keys,values = Seq.unzip keysValues Chart.Column( values, @@ -1294,7 +1392,8 @@ module Chart2D = ?TextPosition = TextPosition , ?MultiTextPosition = MultiTextPosition, ?TextFont = TextFont , - ?Marker = Marker + ?Marker = Marker , + ?UseDefaults = UseDefaults ) @@ -1320,9 +1419,9 @@ module Chart2D = [] ?TextPosition : StyleParam.TextPosition, [] ?MultiTextPosition : seq, [] ?TextFont : Font, - [] ?Marker : Marker - - ) = + [] ?Marker : Marker, + [] ?UseDefaults : bool + ) = Chart.Column( values, @@ -1343,7 +1442,8 @@ module Chart2D = ?TextPosition = TextPosition , ?MultiTextPosition = MultiTextPosition, ?TextFont = TextFont , - ?Marker = Marker + ?Marker = Marker , + ?UseDefaults = UseDefaults ) |> GenericChart.mapLayout (Layout.style (BarMode=StyleParam.BarMode.Stack)) @@ -1369,7 +1469,8 @@ module Chart2D = [] ?TextPosition : StyleParam.TextPosition, [] ?MultiTextPosition : seq, [] ?TextFont : Font, - [] ?Marker : Marker + [] ?Marker : Marker, + [] ?UseDefaults : bool ) = let keys,values = Seq.unzip keysValues @@ -1392,7 +1493,8 @@ module Chart2D = ?TextPosition = TextPosition , ?MultiTextPosition = MultiTextPosition, ?TextFont = TextFont , - ?Marker = Marker + ?Marker = Marker , + ?UseDefaults = UseDefaults ) @@ -1423,8 +1525,12 @@ module Chart2D = [] ?ErrorX : Error, [] ?ErrorY : Error, [] ?Cumulative : Cumulative, - [] ?HoverLabel : Hoverlabel - ) = + [] ?HoverLabel : Hoverlabel, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + Trace2D.initHistogram ( Trace2DStyle.Histogram ( ?X = X, @@ -1451,7 +1557,7 @@ module Chart2D = ) |> TraceStyle.Marker(?Color=MarkerColor) |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Visualizes the distribution of the input data as a histogram, automatically determining if the data is to be used for the x or y dimension based on the `orientation` parameter. [] @@ -1479,9 +1585,12 @@ module Chart2D = [] ?ErrorX : Error, [] ?ErrorY : Error, [] ?Cumulative : Cumulative, - [] ?HoverLabel : Hoverlabel - ) = - + [] ?HoverLabel : Hoverlabel, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + let histChart = Trace2D.initHistogram ( Trace2DStyle.Histogram ( @@ -1507,7 +1616,7 @@ module Chart2D = ) |> TraceStyle.Marker(?Color=MarkerColor) |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults match orientation with | StyleParam.Orientation.Horizontal -> @@ -1541,8 +1650,12 @@ module Chart2D = [] ?ColorScale : StyleParam.Colorscale, [] ?ShowScale : bool, [] ?ReverseScale : bool, - [] ?ZSmooth : StyleParam.SmoothAlg - ) = + [] ?ZSmooth : StyleParam.SmoothAlg, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + Trace2D.initHistogram2D ( Trace2DStyle.Histogram2D ( X = x , @@ -1566,7 +1679,7 @@ module Chart2D = ) ) |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Displays the distribution of data based on the five number summary: minimum, first quartile, median, third quartile, and maximum. [] @@ -1595,8 +1708,12 @@ module Chart2D = [] ?Offsetgroup : string, [] ?Notched : bool, [] ?NotchWidth : float, - [] ?QuartileMethod: StyleParam.QuartileMethod + [] ?QuartileMethod: StyleParam.QuartileMethod, + [] ?UseDefaults : bool ) = + + let useDefaults = defaultArg UseDefaults true + Trace2D.initBoxPlot ( Trace2DStyle.BoxPlot( ?X = x, @@ -1621,7 +1738,7 @@ module Chart2D = ) |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) |> TraceStyle.Marker(?Color=MarkerColor, ?OutlierColor=OutlierColor, ?OutlierWidth=OutlierWidth) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Displays the distribution of data based on the five number summary: minimum, first quartile, median, third quartile, and maximum. @@ -1650,9 +1767,10 @@ module Chart2D = [] ?Offsetgroup : string, [] ?Notched : bool, [] ?NotchWidth : float, - [] ?QuartileMethod: StyleParam.QuartileMethod - + [] ?QuartileMethod: StyleParam.QuartileMethod, + [] ?UseDefaults : bool ) = + let x,y = Seq.unzip xy Chart.BoxPlot( x, y, @@ -1677,7 +1795,8 @@ module Chart2D = ?Offsetgroup = Offsetgroup , ?Notched = Notched , ?NotchWidth = NotchWidth , - ?QuartileMethod = QuartileMethod + ?QuartileMethod = QuartileMethod, + ?UseDefaults = UseDefaults ) @@ -1714,9 +1833,12 @@ module Chart2D = [] ?ScaleMode : StyleParam.ScaleMode, [] ?Side : StyleParam.ViolinSide, [] ?Span : StyleParam.Range, - [] ?SpanMode : StyleParam.SpanMode + [] ?SpanMode : StyleParam.SpanMode, + [] ?UseDefaults : bool ) = + let useDefaults = defaultArg UseDefaults true + let box = Box |> Option.defaultValue (TraceObjects.Box.init()) @@ -1755,7 +1877,7 @@ module Chart2D = ) |> TraceStyle.TraceInfo(?Name=Name, ?ShowLegend=ShowLegend, ?Opacity=Opacity) |> TraceStyle.Marker(?Color=MarkerColor, ?OutlierColor= OutlierColor, ?OutlierWidth= OutlierWidth) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Displays the distribution of data based on the five number summary: minimum, first quartile, median, third quartile, and maximum. @@ -1789,39 +1911,42 @@ module Chart2D = [] ?ScaleMode : StyleParam.ScaleMode, [] ?Side : StyleParam.ViolinSide, [] ?Span : StyleParam.Range, - [] ?SpanMode : StyleParam.SpanMode + [] ?SpanMode : StyleParam.SpanMode, + [] ?UseDefaults : bool ) = - let x,y = Seq.unzip xy - Chart.Violin( - x, y, - ?Name = Name , - ?ShowLegend = ShowLegend , - ?FillColor = FillColor , - ?Opacity = Opacity , - ?Points = Points , - ?Jitter = Jitter , - ?PointPos = PointPos , - ?Orientation = Orientation , - ?Width = Width , - ?MarkerColor = MarkerColor , - ?OutlierColor = OutlierColor , - ?OutlierWidth = OutlierWidth , - ?Marker = Marker , - ?Line = Line , - ?AlignmentGroup= AlignmentGroup, - ?OffsetGroup = OffsetGroup , - ?ShowBox = ShowBox , - ?BoxWidth = BoxWidth , - ?BoxFillColor = BoxFillColor , - ?Box = Box , - ?BandWidth = BandWidth , - ?MeanLine = MeanLine , - ?ScaleGroup = ScaleGroup , - ?ScaleMode = ScaleMode , - ?Side = Side , - ?Span = Span , - ?SpanMode = SpanMode - ) + + let x,y = Seq.unzip xy + Chart.Violin( + x, y, + ?Name = Name , + ?ShowLegend = ShowLegend , + ?FillColor = FillColor , + ?Opacity = Opacity , + ?Points = Points , + ?Jitter = Jitter , + ?PointPos = PointPos , + ?Orientation = Orientation , + ?Width = Width , + ?MarkerColor = MarkerColor , + ?OutlierColor = OutlierColor , + ?OutlierWidth = OutlierWidth , + ?Marker = Marker , + ?Line = Line , + ?AlignmentGroup= AlignmentGroup, + ?OffsetGroup = OffsetGroup , + ?ShowBox = ShowBox , + ?BoxWidth = BoxWidth , + ?BoxFillColor = BoxFillColor , + ?Box = Box , + ?BandWidth = BandWidth , + ?MeanLine = MeanLine , + ?ScaleGroup = ScaleGroup , + ?ScaleMode = ScaleMode , + ?Side = Side , + ?Span = Span , + ?SpanMode = SpanMode , + ?UseDefaults = UseDefaults + ) /// Computes the bi-dimensional histogram of two data samples and auto-determines the bin size. @@ -1852,35 +1977,38 @@ module Chart2D = [] ?ShowScale : bool, [] ?ReverseScale : bool, [] ?Contours : Contours, - [] ?NContours : int + [] ?NContours : int, + [] ?UseDefaults : bool ) = - Trace2D.initHistogram2DContour ( - Trace2DStyle.Histogram2DContour ( - X = x, - Y = y, - ?Z = Z , - ?HistFunc = HistFunc , - ?HistNorm = HistNorm , - ?NBinsX = NBinsX , - ?NBinsY = NBinsY , - ?BinGroup = BinGroup , - ?XBinGroup = XBinGroup , - ?XBins = XBins , - ?YBinGroup = YBinGroup , - ?YBins = YBins , - ?Marker = Marker , - ?Line = Line , - ?ColorBar = ColorBar , - ?ColorScale = ColorScale , - ?ShowScale = ShowScale , - ?ReverseScale = ReverseScale, - ?Contours = Contours , - ?NContours = NContours - ) + let useDefaults = defaultArg UseDefaults true + + Trace2D.initHistogram2DContour ( + Trace2DStyle.Histogram2DContour ( + X = x, + Y = y, + ?Z = Z , + ?HistFunc = HistFunc , + ?HistNorm = HistNorm , + ?NBinsX = NBinsX , + ?NBinsY = NBinsY , + ?BinGroup = BinGroup , + ?XBinGroup = XBinGroup , + ?XBins = XBins , + ?YBinGroup = YBinGroup , + ?YBins = YBins , + ?Marker = Marker , + ?Line = Line , + ?ColorBar = ColorBar , + ?ColorScale = ColorScale , + ?ShowScale = ShowScale , + ?ReverseScale = ReverseScale, + ?Contours = Contours , + ?NContours = NContours ) - |> TraceStyle.TraceInfo(?Name=Name, ?ShowLegend=ShowLegend, ?Opacity=Opacity) - |> TraceStyle.Line(?Color=LineColor, ?Dash=LineDash) - |> GenericChart.ofTraceObject + ) + |> TraceStyle.TraceInfo(?Name=Name, ?ShowLegend=ShowLegend, ?Opacity=Opacity) + |> TraceStyle.Line(?Color=LineColor, ?Dash=LineDash) + |> GenericChart.ofTraceObject useDefaults /// Shows a graphical representation of a 3-dimensional surface by plotting constant z slices, called contours, on a 2-dimensional format. /// That is, given a value for z, lines are drawn for connecting the (x,y) coordinates where that z value occurs. @@ -1897,8 +2025,12 @@ module Chart2D = [] ?Ygap, [] ?zSmooth, [] ?ColorBar, - []?UseWebGL : bool) - = + []?UseWebGL : bool, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + let style = Trace2DStyle.Heatmap( Z=data, @@ -1915,7 +2047,7 @@ module Chart2D = let useWebGL = defaultArg UseWebGL false - Chart.renderHeatmapTrace useWebGL style + Chart.renderHeatmapTrace useDefaults useWebGL style [] @@ -1932,8 +2064,11 @@ module Chart2D = [] ?ColorModel : StyleParam.ColorModel, [] ?ZMax : StyleParam.ColorComponentBound, [] ?ZMin : StyleParam.ColorComponentBound, - [] ?ZSmooth : StyleParam.SmoothAlg - ) = + [] ?ZSmooth : StyleParam.SmoothAlg, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true Trace2D.initImage ( Trace2DStyle.Image ( @@ -1951,7 +2086,7 @@ module Chart2D = ?ZSmooth = ZSmooth ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults [] static member Image @@ -1965,8 +2100,11 @@ module Chart2D = [] ?Y : seq<#IConvertible>, [] ?ZMax : StyleParam.ColorComponentBound, [] ?ZMin : StyleParam.ColorComponentBound, - [] ?ZSmooth : StyleParam.SmoothAlg - ) = + [] ?ZSmooth : StyleParam.SmoothAlg, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let z' = z @@ -1988,28 +2126,33 @@ module Chart2D = ?ZSmooth = ZSmooth ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Shows a graphical representation of data where the individual values contained in a matrix are represented as colors. [] static member Contour(data:seq<#seq<#IConvertible>>, - [] ?X, - [] ?Y, - [] ?Name, - [] ?ShowLegend, - [] ?Opacity, - [] ?Colorscale, - [] ?Showscale, - [] ?zSmooth, - [] ?ColorBar) = - Trace2D.initContour ( - Trace2DStyle.Contour( - Z=data,?X=X, ?Y=Y, - ?Colorscale=Colorscale,?Showscale=Showscale,?zSmooth=zSmooth,?ColorBar=ColorBar + [] ?X, + [] ?Y, + [] ?Name, + [] ?ShowLegend, + [] ?Opacity, + [] ?Colorscale, + [] ?Showscale, + [] ?zSmooth, + [] ?ColorBar, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + + Trace2D.initContour ( + Trace2DStyle.Contour( + Z=data,?X=X, ?Y=Y, + ?Colorscale=Colorscale,?Showscale=Showscale,?zSmooth=zSmooth,?ColorBar=ColorBar + ) ) - ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> GenericChart.ofTraceObject + |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) + |> GenericChart.ofTraceObject useDefaults /// Creates an OHLC (open-high-low-close) chart. OHLC charts are typically used to illustrate movements in the price of a financial instrument over time. /// @@ -2044,8 +2187,12 @@ module Chart2D = []?Decreasing : Line, []?Tickwidth : float, []?Line : Line, - []?XCalendar : StyleParam.Calendar - ) = + []?XCalendar : StyleParam.Calendar, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + Trace2D.initOHLC( Trace2DStyle.OHLC( ``open`` = ``open`` , @@ -2060,7 +2207,7 @@ module Chart2D = ?XCalendar = XCalendar ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Creates an OHLC (open-high-low-close) chart. OHLC charts are typically used to illustrate movements in the price of a financial instrument over time. /// @@ -2079,12 +2226,16 @@ module Chart2D = static member OHLC ( stockTimeSeries: seq, - []?Increasing : Line, - []?Decreasing : Line, - []?Tickwidth : float, - []?Line : Line, - []?XCalendar : StyleParam.Calendar - ) = + [] ?Increasing : Line, + [] ?Decreasing : Line, + [] ?Tickwidth : float, + [] ?Line : Line, + [] ?XCalendar : StyleParam.Calendar, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + Trace2D.initOHLC( Trace2DStyle.OHLC( ``open`` = (stockTimeSeries |> Seq.map (snd >> (fun x -> x.Open))) , @@ -2099,7 +2250,7 @@ module Chart2D = ?XCalendar = XCalendar ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Creates a candlestick chart. A candlestick cart is a style of financial chart used to describe price movements of a /// security, derivative, or currency. Each "candlestick" typically shows one day, thus a one-month chart may show the 20 @@ -2136,8 +2287,12 @@ module Chart2D = []?Decreasing : Line, []?WhiskerWidth : float, []?Line : Line, - []?XCalendar : StyleParam.Calendar - ) = + []?XCalendar : StyleParam.Calendar, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + Trace2D.initCandlestick( Trace2DStyle.Candlestick( ``open`` = ``open`` , @@ -2152,7 +2307,7 @@ module Chart2D = ?XCalendar = XCalendar ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Creates an OHLC (open-high-low-close) chart. OHLC charts are typically used to illustrate movements in the price of a financial instrument over time. /// @@ -2175,8 +2330,12 @@ module Chart2D = []?Decreasing : Line, []?WhiskerWidth : float, []?Line : Line, - []?XCalendar : StyleParam.Calendar - ) = + []?XCalendar : StyleParam.Calendar, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + Trace2D.initCandlestick( Trace2DStyle.Candlestick( ``open`` = (stockTimeSeries |> Seq.map (snd >> (fun x -> x.Open))) , @@ -2191,7 +2350,7 @@ module Chart2D = ?XCalendar = XCalendar ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults @@ -2209,8 +2368,11 @@ module Chart2D = [] ?Domain, [] ?Labelfont, [] ?Tickfont, - [] ?Rangefont - ) = + [] ?Rangefont, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let dims' = dims |> Seq.map (fun (k,vals) -> @@ -2222,7 +2384,7 @@ module Chart2D = Trace2DStyle.Splom (Dimensions=dims') ) |> TraceStyle.Line(?Width=Width,?Color=Color,?Dash=Dash,?Colorscale=Colorscale) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Computes the Splom plot @@ -2237,12 +2399,16 @@ module Chart2D = [] ?Domain, [] ?Labelfont, [] ?Tickfont, - [] ?Rangefont - ) = + [] ?Rangefont, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + Trace2D.initSplom ( Trace2DStyle.Splom ( Dimensions=dims ) ) |> TraceStyle.Line(?Width=Width,?Color=Color,?Dash=Dash,?Colorscale=Colorscale) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults diff --git a/src/Plotly.NET/ChartAPI/Chart3D.fs b/src/Plotly.NET/ChartAPI/Chart3D.fs index c5cfdee9e..ade0ef311 100644 --- a/src/Plotly.NET/ChartAPI/Chart3D.fs +++ b/src/Plotly.NET/ChartAPI/Chart3D.fs @@ -33,14 +33,18 @@ module Chart3D = [] ?TextPosition, [] ?TextFont, [] ?Dash, - [] ?Width + [] ?Width, + [] ?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) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Uses points, line or both depending on the mode to represent 3d-data points @@ -55,9 +59,13 @@ module Chart3D = [] ?TextPosition, [] ?TextFont, [] ?Dash, - [] ?Width) = - 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) + [] ?Width, + [] ?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) /// [] @@ -71,8 +79,10 @@ module Chart3D = [] ?Opacity, [] ?Labels, [] ?TextPosition, - [] ?TextFont - ) = + [] ?TextFont, + [] ?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) @@ -88,7 +98,8 @@ module Chart3D = ?Opacity = Opacity, ?Labels = Labels, ?TextPosition = TextPosition, - ?TextFont = TextFont + ?TextFont = TextFont, + ?UseDefaults = UseDefaults ) /// @@ -103,8 +114,10 @@ module Chart3D = [] ?Opacity, [] ?Labels, [] ?TextPosition, - [] ?TextFont - ) = + [] ?TextFont, + [] ?UseDefaults : bool + ) = + let x, y, z = Seq.unzip3 xyz Chart.Point3d( @@ -116,7 +129,8 @@ module Chart3D = ?Opacity = Opacity, ?Labels = Labels, ?TextPosition = TextPosition, - ?TextFont = TextFont + ?TextFont = TextFont, + ?UseDefaults = UseDefaults ) @@ -135,7 +149,8 @@ module Chart3D = [] ?TextPosition, [] ?TextFont, [] ?Dash, - [] ?Width + [] ?Width, + [] ?UseDefaults : bool ) = let changeMode = let isShowMarker = @@ -159,7 +174,8 @@ module Chart3D = ?TextPosition = TextPosition, ?TextFont = TextFont , ?Dash = Dash , - ?Width = Width + ?Width = Width , + ?UseDefaults = UseDefaults ) /// Uses points, line or both depending on the mode to represent 3d-data points @@ -177,8 +193,10 @@ module Chart3D = [] ?TextPosition, [] ?TextFont, [] ?Dash, - [] ?Width + [] ?Width, + [] ?UseDefaults : bool ) = + let x, y, z = Seq.unzip3 xyz Chart.Line3d( @@ -193,7 +211,8 @@ module Chart3D = ?TextPosition = TextPosition, ?TextFont = TextFont , ?Dash = Dash , - ?Width = Width + ?Width = Width , + ?UseDefaults = UseDefaults ) /// @@ -208,8 +227,11 @@ module Chart3D = [] ?Opacity, [] ?Labels, [] ?TextPosition, - [] ?TextFont - ) = + [] ?TextFont, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) Trace3D.initScatter3d ( @@ -223,7 +245,7 @@ module Chart3D = |> 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 + |> GenericChart.ofTraceObject useDefaults /// [] @@ -237,8 +259,10 @@ module Chart3D = [] ?Opacity, [] ?Labels, [] ?TextPosition, - [] ?TextFont - ) = + [] ?TextFont, + [] ?UseDefaults : bool + ) = + let x, y, z = Seq.unzip3 xyz Chart.Bubble3d( @@ -250,7 +274,8 @@ module Chart3D = ?Opacity = Opacity, ?Labels = Labels, ?TextPosition = TextPosition, - ?TextFont = TextFont + ?TextFont = TextFont, + ?UseDefaults = UseDefaults ) @@ -267,21 +292,25 @@ module Chart3D = [] ?Contours, [] ?ColorScale, [] ?ShowScale, - [] ?ColorBar + [] ?ColorBar, + [] ?UseDefaults : bool ) = - Trace3D.initSurface ( - Trace3DStyle.Surface( - ?X=X, - ?Y=Y, - Z=zData, - ?Contours=Contours, - ?ColorScale=ColorScale, - ?ShowScale=ShowScale, - ?ColorBar=ColorBar - ) - ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> GenericChart.ofTraceObject + + let useDefaults = defaultArg UseDefaults true + + Trace3D.initSurface ( + Trace3DStyle.Surface( + ?X=X, + ?Y=Y, + Z=zData, + ?Contours=Contours, + ?ColorScale=ColorScale, + ?ShowScale=ShowScale, + ?ColorBar=ColorBar + ) + ) + |> 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 @@ -296,24 +325,32 @@ module Chart3D = [] ?ShowLegend, [] ?Opacity, [] ?Color, - [] ?Contours, + [] ?Contour, [] ?ColorScale, [] ?ShowScale, - [] ?ColorBar + [] ?ColorBar, + [] ?UseDefaults : bool ) = - Trace3D.initMesh3d ( - Trace3DStyle.Mesh3d( - X = x, - Y = y, - Z = z, - ?I = I, - ?J = J, - ?K = K, - ?Color = Color - ) - ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> GenericChart.ofTraceObject + + 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 + ) + ) + |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) + |> GenericChart.ofTraceObject useDefaults [] static member Cone @@ -324,8 +361,11 @@ module Chart3D = [] ?Opacity, [] ?ColorScale, [] ?ShowScale, - [] ?ColorBar - ) = + [] ?ColorBar, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true Trace3D.initCone( Trace3DStyle.Cone( @@ -344,7 +384,7 @@ module Chart3D = ) ) |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults [] static member Cone @@ -355,8 +395,11 @@ module Chart3D = [] ?Opacity, [] ?ColorScale, [] ?ShowScale, - [] ?ColorBar - ) = + [] ?ColorBar, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let x, y, z = Seq.unzip3 coneXYZ let u, v, w = Seq.unzip3 coneUVW @@ -367,7 +410,8 @@ module Chart3D = ?Opacity = Opacity , ?ColorScale = ColorScale , ?ShowScale = ShowScale , - ?ColorBar = ColorBar + ?ColorBar = ColorBar , + ?UseDefaults= UseDefaults ) @@ -382,9 +426,11 @@ module Chart3D = [] ?ShowScale, [] ?ColorBar, [] ?MaxDisplayed: int, - [] ?Starts: StreamTubeStarts + [] ?Starts: StreamTubeStarts, + [] ?UseDefaults : bool + ) = - ) = + let useDefaults = defaultArg UseDefaults true Trace3D.initStreamTube( Trace3DStyle.StreamTube( @@ -405,7 +451,7 @@ module Chart3D = ) ) |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults [] @@ -419,8 +465,11 @@ module Chart3D = [] ?ShowScale, [] ?ColorBar, [] ?MaxDisplayed: int, - [] ?Starts: StreamTubeStarts - ) = + [] ?Starts: StreamTubeStarts, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let x, y, z = Seq.unzip3 streamTubeXYZ let u, v, w = Seq.unzip3 streamTubeUVW @@ -433,7 +482,8 @@ module Chart3D = ?ShowScale = ShowScale , ?ColorBar = ColorBar , ?MaxDisplayed = MaxDisplayed , - ?Starts = Starts + ?Starts = Starts , + ?UseDefaults = UseDefaults ) @@ -451,8 +501,11 @@ module Chart3D = [] ?IsoMax, [] ?Caps : Caps, [] ?Slices : Slices, - [] ?Surface : Surface - ) = + [] ?Surface : Surface, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true Trace3D.initVolume( Trace3DStyle.Volume( X = x, @@ -473,7 +526,7 @@ module Chart3D = ) ) |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults [] @@ -490,8 +543,11 @@ module Chart3D = [] ?IsoMax, [] ?Caps : Caps, [] ?Slices : Slices, - [] ?Surface : Surface - ) = + [] ?Surface : Surface, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true Trace3D.initIsoSurface( Trace3DStyle.IsoSurface( X = x, @@ -512,5 +568,5 @@ module Chart3D = ) ) |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults \ No newline at end of file diff --git a/src/Plotly.NET/ChartAPI/ChartCarpet.fs b/src/Plotly.NET/ChartAPI/ChartCarpet.fs index a7cd53f2b..f96b73a16 100644 --- a/src/Plotly.NET/ChartAPI/ChartCarpet.fs +++ b/src/Plotly.NET/ChartAPI/ChartCarpet.fs @@ -37,8 +37,11 @@ module ChartCarpet = [] ?XAxis : StyleParam.LinearAxisId, [] ?YAxis : StyleParam.LinearAxisId, [] ?Color : Color, - [] ?CheaterSlope : float - ) = + [] ?CheaterSlope : float, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true TraceCarpet.initCarpet( TraceCarpetStyle.Carpet( Carpet = StyleParam.SubPlotId.Carpet carpetId, @@ -59,7 +62,7 @@ module ChartCarpet = ?CheaterSlope = CheaterSlope ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults [] static member ScatterCarpet @@ -85,8 +88,11 @@ module ChartCarpet = [] ?Marker : Marker, [] ?Dash : StyleParam.DrawingStyle, [] ?Width : float , - [] ?Line : Line - ) = + [] ?Line : Line, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true TraceCarpet.initScatterCarpet( TraceCarpetStyle.ScatterCarpet( A = a, @@ -120,7 +126,7 @@ module ChartCarpet = ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults [] static member ScatterCarpet @@ -145,8 +151,10 @@ module ChartCarpet = [] ?Marker : Marker, [] ?Dash : StyleParam.DrawingStyle, [] ?Width : float , - [] ?Line : Line - ) = + [] ?Line : Line, + [] ?UseDefaults : bool + ) = + let a,b = Seq.unzip ab Chart.ScatterCarpet( @@ -168,7 +176,8 @@ module ChartCarpet = ?Marker = Marker , ?Dash = Dash , ?Width = Width , - ?Line = Line + ?Line = Line , + ?UseDefaults = UseDefaults ) @@ -192,8 +201,11 @@ module ChartCarpet = [] ?TextFont : Font, [] ?Size : int, [] ?MultiSize : seq, - [] ?Marker : Marker - ) = + [] ?Marker : Marker, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) @@ -223,7 +235,7 @@ module ChartCarpet = ?MultiSize = MultiSize ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults [] static member PointCarpet @@ -244,8 +256,9 @@ module ChartCarpet = [] ?TextFont : Font, [] ?Size : int, [] ?MultiSize : seq, - [] ?Marker : Marker - ) = + [] ?Marker : Marker, + [] ?UseDefaults : bool + ) = let a,b = Seq.unzip ab @@ -265,7 +278,8 @@ module ChartCarpet = ?TextFont = TextFont , ?Size = Size , ?MultiSize = MultiSize , - ?Marker = Marker + ?Marker = Marker , + ?UseDefaults = UseDefaults ) [] @@ -292,8 +306,11 @@ module ChartCarpet = [] ?TextFont : Font, [] ?Size : int, [] ?MultiSize : seq, - [] ?Marker : Marker - ) = + [] ?Marker : Marker, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let changeMode = let isShowMarker = @@ -335,7 +352,7 @@ module ChartCarpet = ?Color = Color ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults [] static member LineCarpet @@ -360,8 +377,9 @@ module ChartCarpet = [] ?TextFont : Font, [] ?Size : int, [] ?MultiSize : seq, - [] ?Marker : Marker - ) = + [] ?Marker : Marker, + [] ?UseDefaults : bool + ) = let a,b = Seq.unzip ab @@ -385,7 +403,8 @@ module ChartCarpet = ?TextFont = TextFont , ?Size = Size , ?MultiSize = MultiSize , - ?Marker = Marker + ?Marker = Marker , + ?UseDefaults = UseDefaults ) [] @@ -413,8 +432,11 @@ module ChartCarpet = [] ?TextFont : Font, [] ?Size : int, [] ?MultiSize : seq, - [] ?Marker : Marker - ) = + [] ?Marker : Marker, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let changeMode = let isShowMarker = @@ -458,7 +480,7 @@ module ChartCarpet = ?Smoothing = Smoothing ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults [] static member SplineCarpet @@ -484,8 +506,9 @@ module ChartCarpet = [] ?TextFont : Font, [] ?Size : int, [] ?MultiSize : seq, - [] ?Marker : Marker - ) = + [] ?Marker : Marker, + [] ?UseDefaults : bool + ) = let a,b = Seq.unzip ab @@ -510,7 +533,8 @@ module ChartCarpet = ?TextFont = TextFont , ?Size = Size , ?MultiSize = MultiSize , - ?Marker = Marker + ?Marker = Marker , + ?UseDefaults = UseDefaults ) static member BubbleCarpet @@ -531,8 +555,10 @@ module ChartCarpet = [] ?TextPosition : StyleParam.TextPosition, [] ?MultiTextPosition : seq, [] ?TextFont : Font, - [] ?Marker : Marker - ) = + [] ?Marker : Marker, + [] ?UseDefaults : bool + ) = + Chart.PointCarpet( a,b,carpetAnchorId, MultiSize = sizes, @@ -548,7 +574,8 @@ module ChartCarpet = ?TextPosition = TextPosition , ?MultiTextPosition = MultiTextPosition, ?TextFont = TextFont , - ?Marker = Marker + ?Marker = Marker , + ?UseDefaults = UseDefaults ) static member BubbleCarpet @@ -567,8 +594,9 @@ module ChartCarpet = [] ?TextPosition : StyleParam.TextPosition, [] ?MultiTextPosition : seq, [] ?TextFont : Font, - [] ?Marker : Marker - ) = + [] ?Marker : Marker, + [] ?UseDefaults : bool + ) = let a,b,sizes = Seq.unzip3 absizes @@ -587,7 +615,8 @@ module ChartCarpet = ?TextPosition = TextPosition , ?MultiTextPosition = MultiTextPosition, ?TextFont = TextFont , - ?Marker = Marker + ?Marker = Marker , + ?UseDefaults = UseDefaults ) static member ContourCarpet @@ -607,8 +636,12 @@ module ChartCarpet = [] ?Line : Line, [] ?ColorScale: StyleParam.Colorscale, [] ?ShowScale : bool, - [] ?Contours : Contours - ) = + [] ?Contours : Contours, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + TraceCarpet.initContourCarpet( TraceCarpetStyle.ContourCarpet ( Carpet = StyleParam.SubPlotId.Carpet carpetAnchorId, @@ -631,7 +664,7 @@ module ChartCarpet = ?Color = LineColor ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults static member ContourCarpet @@ -649,8 +682,11 @@ module ChartCarpet = [] ?Line : Line, [] ?ColorScale: StyleParam.Colorscale, [] ?ShowScale : bool, - [] ?Contours : Contours - ) = + [] ?Contours : Contours, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let a,b,z = Seq.unzip3 abz @@ -676,6 +712,6 @@ module ChartCarpet = ?Color = LineColor ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults \ No newline at end of file diff --git a/src/Plotly.NET/ChartAPI/ChartDomain.fs b/src/Plotly.NET/ChartAPI/ChartDomain.fs index 7c11e2a96..c4a3a71b5 100644 --- a/src/Plotly.NET/ChartAPI/ChartDomain.fs +++ b/src/Plotly.NET/ChartAPI/ChartDomain.fs @@ -32,8 +32,11 @@ module ChartDomain = [] ?ShowLegend : bool, [] ?SectionColors : seq, [] ?Opacity : float, - [] ?Sort : bool - ) = + [] ?Sort : bool, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true TraceDomain.initPie( TraceDomainStyle.Pie( Values = values, @@ -50,7 +53,7 @@ module ChartDomain = ) |> TraceStyle.Marker(?Colors=SectionColors) |> TraceStyle.TextLabel(?Text=(if TextLabels.IsSome then TextLabels else Labels),?Textposition=TextPosition) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Shows how proportions of data, shown as pie-shaped pieces, contribute to the data. [] @@ -65,8 +68,10 @@ module ChartDomain = [] ?ShowLegend : bool, [] ?SectionColors : seq, [] ?Opacity : float, - [] ?Sort : bool + [] ?Sort : bool, + [] ?UseDefaults : bool ) = + let values,labels = Seq.unzip valuesLabels Chart.Pie( values, @@ -79,7 +84,8 @@ module ChartDomain = ?ShowLegend = ShowLegend , ?SectionColors = SectionColors, ?Opacity = Opacity , - ?Sort = Sort + ?Sort = Sort , + ?UseDefaults = UseDefaults ) @@ -87,19 +93,22 @@ module ChartDomain = [] static member Doughnut ( - values : seq<#IConvertible>, - [] ?Labels : seq<#IConvertible>, - [] ?Hole : float, - [] ?Name : string, - [] ?TextLabels : seq<#IConvertible>, - [] ?TextPosition : StyleParam.TextPosition, - [] ?Direction : StyleParam.Direction, - [] ?Pull : float, - [] ?ShowLegend : bool, - [] ?SectionColors : seq, - [] ?Opacity : float, - [] ?Sort : bool - ) = + values : seq<#IConvertible>, + [] ?Labels : seq<#IConvertible>, + [] ?Hole : float, + [] ?Name : string, + [] ?TextLabels : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?Direction : StyleParam.Direction, + [] ?Pull : float, + [] ?ShowLegend : bool, + [] ?SectionColors : seq, + [] ?Opacity : float, + [] ?Sort : bool, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let hole' = Option.defaultValue 0.4 Hole TraceDomain.initPie( TraceDomainStyle.Pie( @@ -118,7 +127,7 @@ module ChartDomain = ) |> TraceStyle.Marker(?Colors=SectionColors) |> TraceStyle.TextLabel(?Text=(if TextLabels.IsSome then TextLabels else Labels),?Textposition=TextPosition) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Shows how proportions of data, shown as pie-shaped pieces, contribute to the data as a whole. @@ -135,7 +144,8 @@ module ChartDomain = [] ?ShowLegend : bool, [] ?SectionColors : seq, [] ?Opacity : float, - [] ?Sort : bool + [] ?Sort : bool, + [] ?UseDefaults : bool ) = let values,labels = Seq.unzip valuesLabels Chart.Doughnut( @@ -150,7 +160,8 @@ module ChartDomain = ?SectionColors = SectionColors, ?Opacity = Opacity , ?Hole = Hole , - ?Sort = Sort + ?Sort = Sort, + ?UseDefaults = UseDefaults ) @@ -218,26 +229,29 @@ module ChartDomain = [] ?Aspectratio , [] ?Baseratio , [] ?Insidetextfont, - [] ?Scalegroup + [] ?Scalegroup, + [] ?UseDefaults : bool ) = - TraceDomain.initFunnelArea( - TraceDomainStyle.FunnelArea( - ?Values = Values , - ?Labels = Labels , - ?dLabel = dLabel , - ?Label0 = Label0 , - ?Aspectratio = Aspectratio , - ?Baseratio = Baseratio , - ?Insidetextfont = Insidetextfont, - ?Scalegroup = Scalegroup + let useDefaults = defaultArg UseDefaults true + + TraceDomain.initFunnelArea( + TraceDomainStyle.FunnelArea( + ?Values = Values , + ?Labels = Labels , + ?dLabel = dLabel , + ?Label0 = Label0 , + ?Aspectratio = Aspectratio , + ?Baseratio = Baseratio , + ?Insidetextfont = Insidetextfont, + ?Scalegroup = Scalegroup + ) ) - ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> TraceStyle.Marker(?Color=Color,?Outline=Line) - |> TraceStyle.Domain(?X=X,?Y=Y,?Row=Row,?Column=Column) - |> TraceStyle.TextLabel(?Text=Text,?Textposition=TextPosition) - |> GenericChart.ofTraceObject + |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) + |> TraceStyle.Marker(?Color=Color,?Outline=Line) + |> TraceStyle.Domain(?X=X,?Y=Y,?Row=Row,?Column=Column) + |> TraceStyle.TextLabel(?Text=Text,?Textposition=TextPosition) + |> GenericChart.ofTraceObject useDefaults /// Creates a sunburst chart. Visualize hierarchical data spanning outward radially from root to leaves. @@ -265,30 +279,36 @@ module ChartDomain = /// ///Colors: Sets the color of each sector of this trace. If not specified, the default trace color set is used to pick the sector colors. [] - static member Sunburst(labels,parents, - []?Ids, - []?Values, - []?Text, - []?Branchvalues, - []?Level, - []?Maxdepth, - []?Color, - []?ColorBar:ColorBar - ) = - TraceDomain.initSunburst( - TraceDomainStyle.Sunburst( - labels = labels, - parents = parents, - ?Ids = Ids, - ?Values = Values, - ?Text = Text, - ?Branchvalues = Branchvalues, - ?Level = Level, - ?Maxdepth = Maxdepth + static member Sunburst + ( + labels,parents, + []?Ids, + []?Values, + []?Text, + []?Branchvalues, + []?Level, + []?Maxdepth, + []?Color, + []?ColorBar: ColorBar, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + TraceDomain.initSunburst( + TraceDomainStyle.Sunburst( + labels = labels, + parents = parents, + ?Ids = Ids, + ?Values = Values, + ?Text = Text, + ?Branchvalues = Branchvalues, + ?Level = Level, + ?Maxdepth = Maxdepth + ) ) - ) - |> TraceStyle.Marker(?Color=Color,?ColorBar=ColorBar) - |> GenericChart.ofTraceObject + |> TraceStyle.Marker(?Color=Color,?ColorBar=ColorBar) + |> GenericChart.ofTraceObject useDefaults + /// Creates a treemap chart. Treemap charts visualize hierarchical data using nested rectangles. Same as Sunburst the hierarchy is defined by labels and parents attributes. Click on one sector to zoom in/out, which also displays a pathbar in the upper-left corner of your treemap. To zoom out you can use the path bar as well. @@ -315,18 +335,23 @@ module ChartDomain = /// ///Colors: Sets the color of each sector of this trace. If not specified, the default trace color set is used to pick the sector colors. [] - static member Treemap(labels,parents, - []?Ids, - []?Values, - []?Text, - []?Branchvalues, - []?Tiling, - []?PathBar, - []?Level, - []?Maxdepth, - []?Color, - []?ColorBar:ColorBar - ) = + static member Treemap + ( + labels,parents, + []?Ids, + []?Values, + []?Text, + []?Branchvalues, + []?Tiling, + []?PathBar, + []?Level, + []?Maxdepth, + []?Color, + []?ColorBar:ColorBar, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true TraceDomain.initTreemap( TraceDomainStyle.Treemap( labels = labels, @@ -342,7 +367,7 @@ module ChartDomain = ) ) |> TraceStyle.Marker(?Color=Color,?ColorBar=ColorBar) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Computes the parallel coordinates plot @@ -359,8 +384,11 @@ module ChartDomain = [] ?Domain, [] ?Labelfont, [] ?Tickfont, - [] ?Rangefont - ) = + [] ?Rangefont, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let dims' = dims @@ -378,7 +406,7 @@ module ChartDomain = ) ) |> TraceStyle.Line(?Width=Width,?Color=Color,?Dash=Dash,?Colorscale=Colorscale) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Computes the parallel coordinates plot @@ -393,8 +421,11 @@ module ChartDomain = [] ?Domain, [] ?Labelfont, [] ?Tickfont, - [] ?Rangefont - ) = + [] ?Rangefont, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true TraceDomain.initParallelCoord ( TraceDomainStyle.ParallelCoord ( @@ -406,7 +437,7 @@ module ChartDomain = ) ) |> TraceStyle.Line(?Width=Width,?Color=Color,?Dash=Dash,?Colorscale=Colorscale) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults ///Parallel categories diagram for multidimensional categorical data. [] @@ -422,8 +453,11 @@ module ChartDomain = [] ?Domain, [] ?Labelfont, [] ?Tickfont, - [] ?Rangefont - ) = + [] ?Rangefont, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let dims' = dims |> Seq.map (fun (k,vals) -> @@ -440,7 +474,7 @@ module ChartDomain = ) ) |> TraceStyle.Line(?Width=Width,?Color=Color,?Dash=Dash,?Colorscale=Colorscale) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// [] @@ -454,8 +488,11 @@ module ChartDomain = [] ?Domain, [] ?Labelfont, [] ?Tickfont, - [] ?Rangefont - ) = + [] ?Rangefont, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true TraceDomain.initParallelCategories( TraceDomainStyle.ParallelCategories( Dimensions=dims, @@ -467,7 +504,7 @@ module ChartDomain = ) ) |> TraceStyle.Line(?Width=Width,?Dash=Dash,?Colorscale=Colorscale) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// creates table out of header sequence and row sequences @@ -486,9 +523,12 @@ module ChartDomain = [] ?HeightHeader, [] ?HeightCells, [] ?LineHeader, - [] ?LineCells + [] ?LineCells, + [] ?UseDefaults : bool ) = + let useDefaults = defaultArg UseDefaults true + TraceDomain.initTable ( let CellFilling = @@ -508,28 +548,31 @@ module ChartDomain = ?ColumnOrder = ColumnOrder ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// creates table out of header sequence and row sequences [] static member Indicator ( - value : IConvertible, - mode : StyleParam.IndicatorMode, - [] ?Range : StyleParam.Range, - [] ?Name : string, - [] ?Title : string, - [] ?ShowLegend : bool, - [] ?Domain : Domain, - [] ?Align : StyleParam.IndicatorAlignment, - [] ?DeltaReference : #IConvertible, - [] ?Delta : IndicatorDelta, - [] ?Number : IndicatorNumber, - [] ?GaugeShape : StyleParam.IndicatorGaugeShape, - [] ?Gauge : IndicatorGauge, - [] ?ShowGaugeAxis : bool, - [] ?GaugeAxis : LinearAxis + value : IConvertible, + mode : StyleParam.IndicatorMode, + [] ?Range : StyleParam.Range, + [] ?Name : string, + [] ?Title : string, + [] ?ShowLegend : bool, + [] ?Domain : Domain, + [] ?Align : StyleParam.IndicatorAlignment, + [] ?DeltaReference : #IConvertible, + [] ?Delta : IndicatorDelta, + [] ?Number : IndicatorNumber, + [] ?GaugeShape : StyleParam.IndicatorGaugeShape, + [] ?Gauge : IndicatorGauge, + [] ?ShowGaugeAxis : bool, + [] ?GaugeAxis : LinearAxis, + [] ?UseDefaults : bool ) = + + let useDefaults = defaultArg UseDefaults true let axis = GaugeAxis |> Option.defaultValue(LinearAxis.init()) @@ -559,37 +602,40 @@ module ChartDomain = Gauge = gauge ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// creates table out of header sequence and row sequences [] static member Icicle ( labels : seq<#IConvertible>, - parents : seq<#IConvertible>, - [] ?Name : string, - [] ?ShowLegend : bool, - [] ?Values : seq<#IConvertible>, - [] ?Opacity : float, - [] ?MultiOpacity : seq, - [] ?Color : Color, - [] ?ColorScale : StyleParam.Colorscale, - [] ?ShowScale : bool, - [] ?Marker : Marker, - [] ?Text : #IConvertible, - [] ?MultiText : seq<#IConvertible>, - [] ?TextPosition : StyleParam.TextPosition, - [] ?MultiTextPosition : seq, - [] ?Domain : Domain, - [] ?BranchValues : StyleParam.BranchValues, - [] ?Count : StyleParam.IcicleCount, - [] ?TilingOrientation : StyleParam.Orientation, - [] ?TilingFlip : StyleParam.TilingFlip, - [] ?Tiling : IcicleTiling, - [] ?PathBarEdgeShape : StyleParam.PathbarEdgeShape, - [] ?PathBar : Pathbar + parents : seq<#IConvertible>, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Values : seq<#IConvertible>, + [] ?Opacity : float, + [] ?MultiOpacity : seq, + [] ?Color : Color, + [] ?ColorScale : StyleParam.Colorscale, + [] ?ShowScale : bool, + [] ?Marker : Marker, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?Domain : Domain, + [] ?BranchValues : StyleParam.BranchValues, + [] ?Count : StyleParam.IcicleCount, + [] ?TilingOrientation : StyleParam.Orientation, + [] ?TilingFlip : StyleParam.TilingFlip, + [] ?Tiling : IcicleTiling, + [] ?PathBarEdgeShape : StyleParam.PathbarEdgeShape, + [] ?PathBar : Pathbar, + [] ?UseDefaults : bool ) = + let useDefaults = defaultArg UseDefaults true + let tiling = Tiling |> Option.defaultValue(IcicleTiling.init()) @@ -626,34 +672,35 @@ module ChartDomain = ?ShowScale = ShowScale ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// creates table out of header sequence and row sequences [] static member Icicle ( - labelsParents: seq<#IConvertible * #IConvertible>, - [] ?Name : string, - [] ?ShowLegend : bool, - [] ?Values : seq<#IConvertible>, - [] ?Opacity : float, - [] ?MultiOpacity : seq, - [] ?Color : Color, - [] ?ColorScale : StyleParam.Colorscale, - [] ?ShowScale : bool, - [] ?Marker : Marker, - [] ?Text : #IConvertible, - [] ?MultiText : seq<#IConvertible>, - [] ?TextPosition : StyleParam.TextPosition, - [] ?MultiTextPosition : seq, - [] ?Domain : Domain, - [] ?BranchValues : StyleParam.BranchValues, - [] ?Count : StyleParam.IcicleCount, - [] ?TilingOrientation : StyleParam.Orientation, - [] ?TilingFlip : StyleParam.TilingFlip, - [] ?Tiling : IcicleTiling, - [] ?PathBarEdgeShape : StyleParam.PathbarEdgeShape, - [] ?PathBar : Pathbar + labelsParents: seq<#IConvertible * #IConvertible>, + [] ?Name : string, + [] ?ShowLegend : bool, + [] ?Values : seq<#IConvertible>, + [] ?Opacity : float, + [] ?MultiOpacity : seq, + [] ?Color : Color, + [] ?ColorScale : StyleParam.Colorscale, + [] ?ShowScale : bool, + [] ?Marker : Marker, + [] ?Text : #IConvertible, + [] ?MultiText : seq<#IConvertible>, + [] ?TextPosition : StyleParam.TextPosition, + [] ?MultiTextPosition : seq, + [] ?Domain : Domain, + [] ?BranchValues : StyleParam.BranchValues, + [] ?Count : StyleParam.IcicleCount, + [] ?TilingOrientation : StyleParam.Orientation, + [] ?TilingFlip : StyleParam.TilingFlip, + [] ?Tiling : IcicleTiling, + [] ?PathBarEdgeShape : StyleParam.PathbarEdgeShape, + [] ?PathBar : Pathbar, + [] ?UseDefaults : bool ) = let labels, parents = Seq.unzip labelsParents @@ -680,5 +727,6 @@ module ChartDomain = ?TilingFlip = TilingFlip , ?Tiling = Tiling , ?PathBarEdgeShape = PathBarEdgeShape , - ?PathBar = PathBar + ?PathBar = PathBar , + ?UseDefaults = UseDefaults ) \ No newline at end of file diff --git a/src/Plotly.NET/ChartAPI/ChartMap.fs b/src/Plotly.NET/ChartAPI/ChartMap.fs index d5b80143f..aa5986035 100644 --- a/src/Plotly.NET/ChartAPI/ChartMap.fs +++ b/src/Plotly.NET/ChartAPI/ChartMap.fs @@ -20,7 +20,9 @@ module ChartMap = /// Computes the choropleth map plot [] - static member ChoroplethMap(locations,z, + static member ChoroplethMap + ( + locations,z, [] ?Text, [] ?Locationmode, [] ?Autocolorscale, @@ -30,25 +32,29 @@ module ChartMap = [] ?GeoJson, [] ?FeatureIdKey: string, [] ?Zmin, - [] ?Zmax) = + [] ?Zmax, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true - TraceGeo.initChoroplethMap ( - TraceGeoStyle.ChoroplethMap( - Locations=locations, - Z=z, - ?Text=Text, - ?Locationmode=Locationmode, - ?Autocolorscale=Autocolorscale, - ?Colorscale=Colorscale, - ?ColorBar=ColorBar, - ?Marker=Marker, - ?Zmin=Zmin, - ?Zmax=Zmax, - ?GeoJson=GeoJson, - ?FeatureIdKey=FeatureIdKey - ) - ) - |> GenericChart.ofTraceObject + TraceGeo.initChoroplethMap ( + TraceGeoStyle.ChoroplethMap( + Locations=locations, + Z=z, + ?Text=Text, + ?Locationmode=Locationmode, + ?Autocolorscale=Autocolorscale, + ?Colorscale=Colorscale, + ?ColorBar=ColorBar, + ?Marker=Marker, + ?Zmin=Zmin, + ?Zmax=Zmax, + ?GeoJson=GeoJson, + ?FeatureIdKey=FeatureIdKey + ) + ) + |> GenericChart.ofTraceObject useDefaults /// Creates a ScatterGeo chart, where data is visualized on a geographic map. @@ -88,7 +94,9 @@ module ChartMap = /// /// Fillcolor : Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. [] - static member ScatterGeo(longitudes, latitudes, mode, + static member ScatterGeo + ( + longitudes, latitudes, mode, [] ?Name , [] ?ShowLegend , [] ?MarkerSymbol , @@ -103,26 +111,29 @@ module ChartMap = [] ?FeatureIdKey: string , [] ?Connectgaps : bool , [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + [] ?Fillcolor, + [] ?UseDefaults : bool ) = - TraceGeo.initScatterGeo( - TraceGeoStyle.ScatterGeo( - mode = mode , - Longitudes = longitudes , - Latitudes = latitudes , - ?GeoJson = GeoJson , - ?FeatureIdKey = FeatureIdKey , - ?Connectgaps = Connectgaps , - ?Fill = Fill , - ?Fillcolor = Fillcolor - ) - ) - |> 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) - |> GenericChart.ofTraceObject + let useDefaults = defaultArg UseDefaults true + + TraceGeo.initScatterGeo( + TraceGeoStyle.ScatterGeo( + mode = mode , + Longitudes = longitudes , + Latitudes = latitudes , + ?GeoJson = GeoJson , + ?FeatureIdKey = FeatureIdKey , + ?Connectgaps = Connectgaps , + ?Fill = Fill , + ?Fillcolor = Fillcolor + ) + ) + |> 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) + |> GenericChart.ofTraceObject useDefaults /// Creates a ScatterGeo chart, where data is visualized on a geographic map. @@ -177,27 +188,30 @@ module ChartMap = [] ?FeatureIdKey: string , [] ?Connectgaps : bool , [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + [] ?Fillcolor, + [] ?UseDefaults : bool ) = - let longitudes, latitudes = Seq.unzip lonlat - TraceGeo.initScatterGeo( - TraceGeoStyle.ScatterGeo( - mode = mode , - Longitudes = longitudes , - Latitudes = latitudes , - ?GeoJson = GeoJson , - ?FeatureIdKey = FeatureIdKey , - ?Connectgaps = Connectgaps , - ?Fill = Fill , - ?Fillcolor = Fillcolor - ) - ) - |> 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) - |> GenericChart.ofTraceObject + let useDefaults = defaultArg UseDefaults true + let longitudes, latitudes = Seq.unzip lonlat + + TraceGeo.initScatterGeo( + TraceGeoStyle.ScatterGeo( + mode = mode , + Longitudes = longitudes , + Latitudes = latitudes , + ?GeoJson = GeoJson , + ?FeatureIdKey = FeatureIdKey , + ?Connectgaps = Connectgaps , + ?Fill = Fill , + ?Fillcolor = Fillcolor + ) + ) + |> 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) + |> GenericChart.ofTraceObject useDefaults /// Creates a ScatterGeo chart, where data is visualized on a geographic map. /// ScatterGeo charts are the basis of GeoPoint, GeoLine, and GeoBubble Charts, and can be customized as such. We also provide abstractions for those: Chart.GeoPoint, Chart.GeoLine, Chart.GeoBubble @@ -251,25 +265,28 @@ module ChartMap = [] ?FeatureIdKey: string , [] ?Connectgaps : bool , [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + [] ?Fillcolor , + [] ?UseDefaults : bool ) = - TraceGeo.initScatterGeo( - TraceGeoStyle.ScatterGeo( - mode = mode , - ?Locations = locations , - ?GeoJson = GeoJson , - ?FeatureIdKey = FeatureIdKey , - ?Connectgaps = Connectgaps , - ?Fill = Fill , - ?Fillcolor = Fillcolor - ) - ) - |> 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) - |> GenericChart.ofTraceObject + let useDefaults = defaultArg UseDefaults true + + TraceGeo.initScatterGeo( + TraceGeoStyle.ScatterGeo( + mode = mode , + ?Locations = locations , + ?GeoJson = GeoJson , + ?FeatureIdKey = FeatureIdKey , + ?Connectgaps = Connectgaps , + ?Fill = Fill , + ?Fillcolor = Fillcolor + ) + ) + |> 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) + |> GenericChart.ofTraceObject useDefaults /// Creates a PointGeo chart, where data is visualized as points on a geographic map. /// @@ -316,27 +333,30 @@ module ChartMap = [] ?FeatureIdKey: string , [] ?Connectgaps : bool , [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + [] ?Fillcolor , + [] ?UseDefaults : bool ) = - let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) + let useDefaults = defaultArg UseDefaults true - TraceGeo.initScatterGeo( - TraceGeoStyle.ScatterGeo( - mode = changeMode StyleParam.Mode.Markers , - Longitudes = longitudes , - Latitudes = latitudes , - ?GeoJson = GeoJson , - ?FeatureIdKey = FeatureIdKey , - ?Connectgaps = Connectgaps , - ?Fill = Fill , - ?Fillcolor = Fillcolor - ) - ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) - |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject + let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) + + TraceGeo.initScatterGeo( + TraceGeoStyle.ScatterGeo( + mode = changeMode StyleParam.Mode.Markers , + Longitudes = longitudes , + Latitudes = latitudes , + ?GeoJson = GeoJson , + ?FeatureIdKey = FeatureIdKey , + ?Connectgaps = Connectgaps , + ?Fill = Fill , + ?Fillcolor = Fillcolor + ) + ) + |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) + |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) + |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) + |> GenericChart.ofTraceObject useDefaults /// Creates a PointGeo chart, where data is visualized as points on a geographic map. /// @@ -381,28 +401,31 @@ module ChartMap = [] ?FeatureIdKey: string , [] ?Connectgaps : bool , [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + [] ?Fillcolor, + [] ?UseDefaults : bool ) = - let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) - let longitudes, latitudes = Seq.unzip lonlat + let useDefaults = defaultArg UseDefaults true - TraceGeo.initScatterGeo( - TraceGeoStyle.ScatterGeo( - mode = changeMode StyleParam.Mode.Markers , - Longitudes = longitudes , - Latitudes = latitudes , - ?GeoJson = GeoJson , - ?FeatureIdKey = FeatureIdKey , - ?Connectgaps = Connectgaps , - ?Fill = Fill , - ?Fillcolor = Fillcolor - ) - ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) - |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject + let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) + let longitudes, latitudes = Seq.unzip lonlat + + TraceGeo.initScatterGeo( + TraceGeoStyle.ScatterGeo( + mode = changeMode StyleParam.Mode.Markers , + Longitudes = longitudes , + Latitudes = latitudes , + ?GeoJson = GeoJson , + ?FeatureIdKey = FeatureIdKey , + ?Connectgaps = Connectgaps , + ?Fill = Fill , + ?Fillcolor = Fillcolor + ) + ) + |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) + |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) + |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) + |> GenericChart.ofTraceObject useDefaults /// Creates a PointGeo chart, where data is visualized as points on a geographic map. /// @@ -447,25 +470,28 @@ module ChartMap = [] ?FeatureIdKey: string , [] ?Connectgaps : bool , [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + [] ?Fillcolor , + [] ?UseDefaults : bool ) = + + let useDefaults = defaultArg UseDefaults true - let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) + let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) - TraceGeo.initScatterGeo( - TraceGeoStyle.ScatterGeo( - mode = changeMode StyleParam.Mode.Markers , - ?Locations = locations , - ?GeoJson = GeoJson , - ?Connectgaps= Connectgaps , - ?Fill = Fill , - ?Fillcolor = Fillcolor - ) - ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) - |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject + TraceGeo.initScatterGeo( + TraceGeoStyle.ScatterGeo( + mode = changeMode StyleParam.Mode.Markers , + ?Locations = locations , + ?GeoJson = GeoJson , + ?Connectgaps= Connectgaps , + ?Fill = Fill , + ?Fillcolor = Fillcolor + ) + ) + |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) + |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) + |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) + |> GenericChart.ofTraceObject useDefaults /// Creates a LineGeo chart, where data is visualized as coordinates connected via lines on a geographic map. /// @@ -521,33 +547,36 @@ module ChartMap = [] ?FeatureIdKey: string , [] ?Connectgaps : bool , [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + [] ?Fillcolor, + [] ?UseDefaults : bool ) = - let changeMode = - let isShowMarker = - match ShowMarkers with - | Some isShow -> isShow - | Option.None -> false - StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) - >> StyleParam.ModeUtils.showMarker (isShowMarker) + let useDefaults = defaultArg UseDefaults true + + let changeMode = + let isShowMarker = + match ShowMarkers with + | Some isShow -> isShow + | Option.None -> false + StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) + >> StyleParam.ModeUtils.showMarker (isShowMarker) - TraceGeo.initScatterGeo( - TraceGeoStyle.ScatterGeo( - mode = changeMode StyleParam.Mode.Lines, - Longitudes = longitudes , - Latitudes = latitudes , - ?GeoJson = GeoJson , - ?FeatureIdKey = FeatureIdKey , - ?Connectgaps = Connectgaps , - ?Fill = Fill , - ?Fillcolor = Fillcolor - ) - ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) - |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject + TraceGeo.initScatterGeo( + TraceGeoStyle.ScatterGeo( + mode = changeMode StyleParam.Mode.Lines, + Longitudes = longitudes , + Latitudes = latitudes , + ?GeoJson = GeoJson , + ?FeatureIdKey = FeatureIdKey , + ?Connectgaps = Connectgaps , + ?Fill = Fill , + ?Fillcolor = Fillcolor + ) + ) + |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) + |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) + |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) + |> GenericChart.ofTraceObject useDefaults /// Creates a LineGeo chart, where data is visualized as coordinates connected via lines on a geographic map. /// @@ -597,34 +626,37 @@ module ChartMap = [] ?FeatureIdKey: string , [] ?Connectgaps : bool , [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + [] ?Fillcolor, + [] ?UseDefaults : bool ) = - let changeMode = - let isShowMarker = - match ShowMarkers with - | Some isShow -> isShow - | Option.None -> false - StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) - >> StyleParam.ModeUtils.showMarker (isShowMarker) - let longitudes, latitudes = Seq.unzip lonlat + let useDefaults = defaultArg UseDefaults true + + let changeMode = + let isShowMarker = + match ShowMarkers with + | Some isShow -> isShow + | Option.None -> false + StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) + >> StyleParam.ModeUtils.showMarker (isShowMarker) + let longitudes, latitudes = Seq.unzip lonlat - TraceGeo.initScatterGeo( - TraceGeoStyle.ScatterGeo( - mode = changeMode StyleParam.Mode.Lines, - Longitudes = longitudes , - Latitudes = latitudes , - ?GeoJson = GeoJson , - ?FeatureIdKey = FeatureIdKey , - ?Connectgaps = Connectgaps , - ?Fill = Fill , - ?Fillcolor = Fillcolor - ) - ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) - |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject + TraceGeo.initScatterGeo( + TraceGeoStyle.ScatterGeo( + mode = changeMode StyleParam.Mode.Lines, + Longitudes = longitudes , + Latitudes = latitudes , + ?GeoJson = GeoJson , + ?FeatureIdKey = FeatureIdKey , + ?Connectgaps = Connectgaps , + ?Fill = Fill , + ?Fillcolor = Fillcolor + ) + ) + |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) + |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) + |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) + |> GenericChart.ofTraceObject useDefaults /// Creates a LineGeo chart, where data is visualized as coordinates connected via lines on a geographic map. /// @@ -674,32 +706,35 @@ module ChartMap = [] ?FeatureIdKey: string , [] ?Connectgaps : bool , [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + [] ?Fillcolor, + [] ?UseDefaults : bool ) = - let changeMode = - let isShowMarker = - match ShowMarkers with - | Some isShow -> isShow - | Option.None -> false - StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) - >> StyleParam.ModeUtils.showMarker (isShowMarker) + let useDefaults = defaultArg UseDefaults true - TraceGeo.initScatterGeo( - TraceGeoStyle.ScatterGeo( - mode = changeMode StyleParam.Mode.Lines, - Locations = locations , - ?GeoJson = GeoJson , - ?FeatureIdKey = FeatureIdKey , - ?Connectgaps = Connectgaps , - ?Fill = Fill , - ?Fillcolor = Fillcolor - ) - ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) - |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject + let changeMode = + let isShowMarker = + match ShowMarkers with + | Some isShow -> isShow + | Option.None -> false + StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) + >> StyleParam.ModeUtils.showMarker (isShowMarker) + + TraceGeo.initScatterGeo( + TraceGeoStyle.ScatterGeo( + mode = changeMode StyleParam.Mode.Lines, + Locations = locations , + ?GeoJson = GeoJson , + ?FeatureIdKey = FeatureIdKey , + ?Connectgaps = Connectgaps , + ?Fill = Fill , + ?Fillcolor = Fillcolor + ) + ) + |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) + |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) + |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) + |> GenericChart.ofTraceObject useDefaults @@ -728,37 +763,42 @@ module ChartMap = /// Sets the area to fill with a solid color. Use with `fillcolor` if not "none". "toself" connects the endpoints of the trace (or each segment of the trace if it has gaps) into a closed shape. /// Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. [] - static member ScatterMapbox(longitudes, latitudes, mode, - [] ?Name , - [] ?ShowLegend , - [] ?Color , - [] ?Opacity , - [] ?Labels , - [] ?TextPosition , - [] ?TextFont , - [] ?Width : float , - [] ?Below : string , - [] ?Connectgaps : bool , - [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + static member ScatterMapbox + ( + longitudes, latitudes, mode, + [] ?Name , + [] ?ShowLegend , + [] ?Color , + [] ?Opacity , + [] ?Labels , + [] ?TextPosition , + [] ?TextFont , + [] ?Width : float , + [] ?Below : string , + [] ?Connectgaps : bool , + [] ?Fill : StyleParam.Fill , + [] ?Fillcolor, + [] ?UseDefaults : bool ) = - TraceMapbox.initScatterMapbox( - TraceMapboxStyle.ScatterMapbox( - mode = mode , - Longitudes = longitudes , - Latitudes = latitudes , - ?Below = Below , - ?Connectgaps = Connectgaps , - ?Fill = Fill , - ?Fillcolor = Fillcolor - ) - ) - |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) - |> TraceStyle.Line(?Color=Color,?Width=Width) - |> TraceStyle.Marker(?Color=Color) - |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject + let useDefaults = defaultArg UseDefaults true + + TraceMapbox.initScatterMapbox( + TraceMapboxStyle.ScatterMapbox( + mode = mode , + Longitudes = longitudes , + Latitudes = latitudes , + ?Below = Below , + ?Connectgaps = Connectgaps , + ?Fill = Fill , + ?Fillcolor = Fillcolor + ) + ) + |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) + |> TraceStyle.Line(?Color=Color,?Width=Width) + |> TraceStyle.Marker(?Color=Color) + |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) + |> GenericChart.ofTraceObject useDefaults /// /// Creates a ScatterMapbox chart, where data is visualized by (longitude,latitude) pairs on a geographic map using mapbox. @@ -784,19 +824,22 @@ module ChartMap = /// Sets the area to fill with a solid color. Use with `fillcolor` if not "none". "toself" connects the endpoints of the trace (or each segment of the trace if it has gaps) into a closed shape. /// Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. [] - static member ScatterMapbox(lonlat, mode, - [] ?Name , - [] ?ShowLegend , - [] ?Color , - [] ?Opacity , - [] ?Labels , - [] ?TextPosition , - [] ?TextFont , - [] ?Width : float , - [] ?Below : string , - [] ?Connectgaps : bool , - [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + static member ScatterMapbox + ( + lonlat, mode, + [] ?Name , + [] ?ShowLegend , + [] ?Color , + [] ?Opacity , + [] ?Labels , + [] ?TextPosition , + [] ?TextFont , + [] ?Width : float , + [] ?Below : string , + [] ?Connectgaps : bool , + [] ?Fill : StyleParam.Fill , + [] ?Fillcolor , + [] ?UseDefaults : bool ) = let longitudes, latitudes = Seq.unzip lonlat @@ -805,18 +848,19 @@ module ChartMap = longitudes, latitudes, mode, - ?Name = Name , - ?ShowLegend = ShowLegend , - ?Color = Color , - ?Opacity = Opacity , - ?Labels = Labels , - ?TextPosition= TextPosition, - ?TextFont = TextFont , - ?Width = Width , - ?Below = Below , - ?Connectgaps = Connectgaps, - ?Fill = Fill , - ?Fillcolor = Fillcolor + ?Name = Name , + ?ShowLegend = ShowLegend , + ?Color = Color , + ?Opacity = Opacity , + ?Labels = Labels , + ?TextPosition = TextPosition, + ?TextFont = TextFont , + ?Width = Width , + ?Below = Below , + ?Connectgaps = Connectgaps, + ?Fill = Fill , + ?Fillcolor = Fillcolor , + ?UseDefaults = UseDefaults ) /// @@ -841,27 +885,30 @@ module ChartMap = /// Sets the area to fill with a solid color. Use with `fillcolor` if not "none". "toself" connects the endpoints of the trace (or each segment of the trace if it has gaps) into a closed shape. /// Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. [] - static member PointMapbox(longitudes,latitudes, - [] ?Name , - [] ?ShowLegend , - [] ?Color , - [] ?Opacity , - [] ?Labels , - [] ?TextPosition , - [] ?TextFont , - [] ?Width : float , - [] ?Below : string , - [] ?Connectgaps : bool , - [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + static member PointMapbox + ( + longitudes,latitudes, + [] ?Name , + [] ?ShowLegend , + [] ?Color , + [] ?Opacity , + [] ?Labels , + [] ?TextPosition , + [] ?TextFont , + [] ?Width : float , + [] ?Below : string , + [] ?Connectgaps : bool , + [] ?Fill : StyleParam.Fill , + [] ?Fillcolor , + [] ?UseDefaults : bool ) = - + let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) Chart.ScatterMapbox( longitudes, latitudes, - mode = changeMode StyleParam.Mode.Markers , + changeMode StyleParam.Mode.Markers , ?Name = Name , ?ShowLegend = ShowLegend , ?Color = Color , @@ -873,7 +920,8 @@ module ChartMap = ?Below = Below , ?Connectgaps = Connectgaps, ?Fill = Fill , - ?Fillcolor = Fillcolor + ?Fillcolor = Fillcolor , + ?UseDefaults = UseDefaults ) /// @@ -897,21 +945,24 @@ module ChartMap = /// Sets the area to fill with a solid color. Use with `fillcolor` if not "none". "toself" connects the endpoints of the trace (or each segment of the trace if it has gaps) into a closed shape. /// Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. [] - static member PointMapbox(lonlat, - [] ?Name , - [] ?ShowLegend , - [] ?Color , - [] ?Opacity , - [] ?Labels , - [] ?TextPosition , - [] ?TextFont , - [] ?Width : float , - [] ?Below : string , - [] ?Connectgaps : bool , - [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + static member PointMapbox + ( + lonlat, + [] ?Name , + [] ?ShowLegend , + [] ?Color , + [] ?Opacity , + [] ?Labels , + [] ?TextPosition , + [] ?TextFont , + [] ?Width : float , + [] ?Below : string , + [] ?Connectgaps : bool , + [] ?Fill : StyleParam.Fill , + [] ?Fillcolor, + [] ?UseDefaults : bool ) = - + let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) let longitudes, latitudes = Seq.unzip lonlat @@ -930,7 +981,8 @@ module ChartMap = ?Below = Below , ?Connectgaps = Connectgaps, ?Fill = Fill , - ?Fillcolor = Fillcolor + ?Fillcolor = Fillcolor , + ?UseDefaults = UseDefaults ) /// /// Creates a LineMapbox chart, where data is visualized by (longitude,latitude) pairs connected by a line on a geographic map using mapbox. @@ -955,23 +1007,25 @@ module ChartMap = /// Sets the area to fill with a solid color. Use with `fillcolor` if not "none". "toself" connects the endpoints of the trace (or each segment of the trace if it has gaps) into a closed shape. /// Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. [] - static member LineMapbox(longitudes,latitudes, - [] ?Name , - [] ?ShowLegend , - [] ?ShowMarkers , - [] ?Color , - [] ?Opacity , - [] ?Labels , - [] ?TextPosition , - [] ?TextFont , - [] ?Width : float , - [] ?Below : string , - [] ?Connectgaps : bool , - [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + static member LineMapbox + ( + longitudes,latitudes, + [] ?Name , + [] ?ShowLegend , + [] ?ShowMarkers , + [] ?Color , + [] ?Opacity , + [] ?Labels , + [] ?TextPosition , + [] ?TextFont , + [] ?Width : float , + [] ?Below : string , + [] ?Connectgaps : bool , + [] ?Fill : StyleParam.Fill , + [] ?Fillcolor , + [] ?UseDefaults : bool ) = - - + let changeMode = let isShowMarker = match ShowMarkers with @@ -983,7 +1037,7 @@ module ChartMap = Chart.ScatterMapbox( longitudes, latitudes, - mode = changeMode StyleParam.Mode.Lines , + changeMode StyleParam.Mode.Lines , ?Name = Name , ?ShowLegend = ShowLegend , ?Color = Color , @@ -995,7 +1049,8 @@ module ChartMap = ?Below = Below , ?Connectgaps = Connectgaps, ?Fill = Fill , - ?Fillcolor = Fillcolor + ?Fillcolor = Fillcolor , + ?UseDefaults = UseDefaults ) /// @@ -1020,22 +1075,25 @@ module ChartMap = /// Sets the area to fill with a solid color. Use with `fillcolor` if not "none". "toself" connects the endpoints of the trace (or each segment of the trace if it has gaps) into a closed shape. /// Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. [] - static member LineMapbox(lonlat, - [] ?Name , - [] ?ShowLegend , - [] ?ShowMarkers , - [] ?Color , - [] ?Opacity , - [] ?Labels , - [] ?TextPosition , - [] ?TextFont , - [] ?Width : float , - [] ?Below : string , - [] ?Connectgaps : bool , - [] ?Fill : StyleParam.Fill , - [] ?Fillcolor + static member LineMapbox + ( + lonlat, + [] ?Name , + [] ?ShowLegend , + [] ?ShowMarkers , + [] ?Color , + [] ?Opacity , + [] ?Labels , + [] ?TextPosition , + [] ?TextFont , + [] ?Width : float , + [] ?Below : string , + [] ?Connectgaps : bool , + [] ?Fill : StyleParam.Fill , + [] ?Fillcolor, + [] ?UseDefaults : bool ) = - + let changeMode = let isShowMarker = match ShowMarkers with @@ -1060,7 +1118,8 @@ module ChartMap = ?Below = Below , ?Connectgaps = Connectgaps, ?Fill = Fill , - ?Fillcolor = Fillcolor + ?Fillcolor = Fillcolor , + ?UseDefaults = UseDefaults ) /// @@ -1085,17 +1144,22 @@ module ChartMap = /// Sets the mid-point of the color domain by scaling `zmin` and/or `zmax` to be equidistant to this point. Value should have the same units as in `z`. Has no effect when `zauto` is `false`. /// Sets the upper bound of the color domain. Value should have the same units as in `z` and if set, `zmin` must be set as well. [] - static member ChoroplethMapbox(locations,z,geoJson, - [] ?FeatureIdKey, - [] ?Text, - [] ?Below, - [] ?Colorscale, - [] ?ColorBar, - [] ?ZAuto, - [] ?ZMin, - [] ?ZMid, - [] ?ZMax - ) = + static member ChoroplethMapbox + ( + locations,z,geoJson, + [] ?FeatureIdKey, + [] ?Text, + [] ?Below, + [] ?Colorscale, + [] ?ColorBar, + [] ?ZAuto, + [] ?ZMin, + [] ?ZMid, + [] ?ZMax, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true TraceMapbox.initChoroplethMapbox ( TraceMapboxStyle.ChoroplethMapbox ( @@ -1113,7 +1177,7 @@ module ChartMap = ?ZMax = ZMax ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// /// Creates a DensityMapbox Chart that draws a bivariate kernel density estimation with a Gaussian kernel from `lon` and `lat` coordinates and optional `z` values using a colorscale. @@ -1133,20 +1197,26 @@ module ChartMap = /// Sets the mid-point of the color domain by scaling `zmin` and/or `zmax` to be equidistant to this point. Value should have the same units as in `z`. Has no effect when `zauto` is `false`. /// Sets the upper bound of the color domain. Value should have the same units as in `z` and if set, `zmin` must be set as well. [] - static member DensityMapbox (lon,lat, - [] ?Z, - [] ?Radius, - [] ?Opacity, - [] ?Text, - [] ?Below, - [] ?Colorscale, - [] ?ColorBar, - [] ?Showscale , - [] ?ZAuto, - [] ?ZMin, - [] ?ZMid, - [] ?ZMax - ) = + static member DensityMapbox + ( + lon,lat, + [] ?Z, + [] ?Radius, + [] ?Opacity, + [] ?Text, + [] ?Below, + [] ?Colorscale, + [] ?ColorBar, + [] ?Showscale , + [] ?ZAuto, + [] ?ZMin, + [] ?ZMid, + [] ?ZMax, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true + TraceMapbox.initDensityMapbox( TraceMapboxStyle.DensityMapbox( Longitudes = lon, @@ -1165,7 +1235,7 @@ module ChartMap = ?ZMax = ZMax ) ) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// /// Creates a DensityMapbox Chart that draws a bivariate kernel density estimation with a Gaussian kernel from `lon` and `lat` coordinates and optional `z` values using a colorscale. @@ -1184,19 +1254,22 @@ module ChartMap = /// Sets the mid-point of the color domain by scaling `zmin` and/or `zmax` to be equidistant to this point. Value should have the same units as in `z`. Has no effect when `zauto` is `false`. /// Sets the upper bound of the color domain. Value should have the same units as in `z` and if set, `zmin` must be set as well. [] - static member DensityMapbox (lonlat, - [] ?Z, - [] ?Radius, - [] ?Opacity, - [] ?Text, - [] ?Below, - [] ?Colorscale, - [] ?ColorBar, - [] ?Showscale , - [] ?ZAuto, - [] ?ZMin, - [] ?ZMid, - [] ?ZMax + static member DensityMapbox + ( + lonlat, + [] ?Z, + [] ?Radius, + [] ?Opacity, + [] ?Text, + [] ?Below, + [] ?Colorscale, + [] ?ColorBar, + [] ?Showscale , + [] ?ZAuto, + [] ?ZMin, + [] ?ZMid, + [] ?ZMax, + [] ?UseDefaults : bool ) = let longitudes, latitudes = Seq.unzip lonlat @@ -1215,5 +1288,6 @@ module ChartMap = ?ZAuto = ZAuto, ?ZMin = ZMin, ?ZMid = ZMid, - ?ZMax = ZMax + ?ZMax = ZMax, + ?UseDefaults= UseDefaults ) \ No newline at end of file diff --git a/src/Plotly.NET/ChartAPI/ChartPolar.fs b/src/Plotly.NET/ChartAPI/ChartPolar.fs index 3d9febcf7..f6790ced2 100644 --- a/src/Plotly.NET/ChartAPI/ChartPolar.fs +++ b/src/Plotly.NET/ChartAPI/ChartPolar.fs @@ -18,32 +18,35 @@ module ChartPolar = [] type Chart = [] - static member internal renderScatterPolarTrace (useWebGL:bool) (style: TracePolar -> TracePolar) = + static member internal renderScatterPolarTrace (useDefaults:bool) (useWebGL:bool) (style: TracePolar -> TracePolar) = if useWebGL then TracePolar.initScatterPolarGL style - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults else TracePolar.initScatterPolar style - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults /// Uses points, line or both depending on the mode to represent data points in a polar chart [] static member ScatterPolar ( r, theta, mode, - [] ?Name, - [] ?ShowLegend, - [] ?MarkerSymbol, - [] ?Color, - [] ?Opacity, - [] ?Labels, - [] ?TextPosition, - [] ?TextFont, - [] ?Dash, - [] ?Width, - [] ?UseWebGL + [] ?Name, + [] ?ShowLegend, + [] ?MarkerSymbol, + [] ?Color, + [] ?Opacity, + [] ?Labels, + [] ?TextPosition, + [] ?TextFont, + [] ?Dash, + [] ?Width, + [] ?UseWebGL, + [] ?UseDefaults : bool ) = + let useDefaults = defaultArg UseDefaults true + let style = TracePolarStyle.ScatterPolar( R = r, @@ -57,7 +60,7 @@ module ChartPolar = let useWebGL = defaultArg UseWebGL false - Chart.renderScatterPolarTrace useWebGL style + Chart.renderScatterPolarTrace useDefaults useWebGL style /// Uses points, line or both depending on the mode to represent data points in a polar chart [] @@ -74,7 +77,8 @@ module ChartPolar = [] ?TextFont, [] ?Dash, [] ?Width, - [] ?UseWebGL + [] ?UseWebGL, + [] ?UseDefaults : bool ) = let r,t = Seq.unzip rtheta @@ -91,7 +95,8 @@ module ChartPolar = ?TextFont=TextFont, ?Dash=Dash, ?Width=Width, - ?UseWebGL = UseWebGL + ?UseWebGL = UseWebGL, + ?UseDefaults = UseDefaults ) /// @@ -107,9 +112,12 @@ module ChartPolar = [] ?Labels, [] ?TextPosition, [] ?TextFont, - [] ?UseWebGL + [] ?UseWebGL, + [] ?UseDefaults : bool ) = + let useDefaults = defaultArg UseDefaults true + let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) let style = @@ -124,7 +132,7 @@ module ChartPolar = let useWebGL = defaultArg UseWebGL false - Chart.renderScatterPolarTrace useWebGL style + Chart.renderScatterPolarTrace useDefaults useWebGL style /// [] @@ -139,8 +147,10 @@ module ChartPolar = [] ?Labels, [] ?TextPosition, [] ?TextFont, - [] ?UseWebGL + [] ?UseWebGL, + [] ?UseDefaults : bool ) = + let r,t = Seq.unzip rTheta Chart.PointPolar( @@ -153,7 +163,8 @@ module ChartPolar = ?Labels = Labels, ?TextPosition = TextPosition, ?TextFont = TextFont, - ?UseWebGL = UseWebGL + ?UseWebGL = UseWebGL, + ?UseDefaults = UseDefaults ) /// @@ -172,8 +183,11 @@ module ChartPolar = [] ?TextFont, [] ?Dash, [] ?Width, - [] ?UseWebGL - ) = + [] ?UseWebGL, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let changeMode = let isShowMarker = match ShowMarkers with @@ -195,7 +209,7 @@ module ChartPolar = let useWebGL = defaultArg UseWebGL false - Chart.renderScatterPolarTrace useWebGL style + Chart.renderScatterPolarTrace useDefaults useWebGL style /// [] @@ -213,25 +227,28 @@ module ChartPolar = [] ?TextFont, [] ?Dash, [] ?Width, - [] ?UseWebGL - ) = - let r,t = Seq.unzip rTheta + [] ?UseWebGL, + [] ?UseDefaults : bool + ) = - Chart.LinePolar( - r, t, - ?Name = Name, - ?ShowLegend = ShowLegend, - ?ShowMarkers = ShowMarkers, - ?MarkerSymbol = MarkerSymbol, - ?Color = Color, - ?Opacity = Opacity, - ?Labels = Labels, - ?TextPosition = TextPosition, - ?TextFont = TextFont, - ?Dash = Dash, - ?Width = Width, - ?UseWebGL = UseWebGL - ) + let r,t = Seq.unzip rTheta + + Chart.LinePolar( + r, t, + ?Name = Name, + ?ShowLegend = ShowLegend, + ?ShowMarkers = ShowMarkers, + ?MarkerSymbol = MarkerSymbol, + ?Color = Color, + ?Opacity = Opacity, + ?Labels = Labels, + ?TextPosition = TextPosition, + ?TextFont = TextFont, + ?Dash = Dash, + ?Width = Width, + ?UseWebGL = UseWebGL, + ?UseDefaults = UseDefaults + ) /// [] @@ -250,8 +267,11 @@ module ChartPolar = [] ?Smoothing, [] ?Dash, [] ?Width, - [] ?UseWebGL - ) = + [] ?UseWebGL, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let changeMode = let isShowMarker = match ShowMarkers with @@ -273,7 +293,7 @@ module ChartPolar = let useWebGL = defaultArg UseWebGL false - Chart.renderScatterPolarTrace useWebGL style + Chart.renderScatterPolarTrace useDefaults useWebGL style /// [] static member SplinePolar @@ -291,11 +311,13 @@ module ChartPolar = [] ?Smoothing, [] ?Dash, [] ?Width, - [] ?UseWebGL - ) = - let r,t = Seq.unzip rTheta + [] ?UseWebGL, + [] ?UseDefaults : bool + ) = + + let r,t = Seq.unzip rTheta - Chart.SplinePolar( + Chart.SplinePolar( r, t, ?Name = Name, ?ShowLegend = ShowLegend, @@ -309,8 +331,9 @@ module ChartPolar = ?Smoothing = Smoothing, ?Dash = Dash, ?Width = Width, - ?UseWebGL = UseWebGL - ) + ?UseWebGL = UseWebGL, + ?UseDefaults = UseDefaults + ) /// [] @@ -325,9 +348,12 @@ module ChartPolar = [] ?Labels, [] ?TextPosition, [] ?TextFont, - [] ?UseWebGL + [] ?UseWebGL, + [] ?UseDefaults : bool ) = + let useDefaults = defaultArg UseDefaults true + let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) let style = @@ -342,7 +368,7 @@ module ChartPolar = let useWebGL = defaultArg UseWebGL false - Chart.renderScatterPolarTrace useWebGL style + Chart.renderScatterPolarTrace useDefaults useWebGL style /// [] @@ -357,8 +383,10 @@ module ChartPolar = [] ?Labels, [] ?TextPosition, [] ?TextFont, - [] ?UseWebGL + [] ?UseWebGL, + [] ?UseDefaults : bool ) = + let r,t,sizes = Seq.unzip3 rThetaSizes Chart.BubblePolar( @@ -371,7 +399,8 @@ module ChartPolar = ?Labels = Labels, ?TextPosition = TextPosition, ?TextFont = TextFont, - ?UseWebGL = UseWebGL + ?UseWebGL = UseWebGL, + ?UseDefaults = UseDefaults ) /// @@ -387,8 +416,11 @@ module ChartPolar = [] ?TextPosition, [] ?TextFont, [] ?Dash, - [] ?LineWidth + [] ?LineWidth, + [] ?UseDefaults : bool ) = + + let useDefaults = defaultArg UseDefaults true TracePolar.initBarPolar( TracePolarStyle.BarPolar( R = r, Theta = theta @@ -398,4 +430,4 @@ module ChartPolar = |> TraceStyle.Line(?Color=Color,?Dash=Dash,?Width=LineWidth) |> TraceStyle.Marker(?Color=Color) |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject \ No newline at end of file + |> GenericChart.ofTraceObject useDefaults \ No newline at end of file diff --git a/src/Plotly.NET/ChartAPI/ChartTernary.fs b/src/Plotly.NET/ChartAPI/ChartTernary.fs index 53a10ef2a..22cca7f09 100644 --- a/src/Plotly.NET/ChartAPI/ChartTernary.fs +++ b/src/Plotly.NET/ChartAPI/ChartTernary.fs @@ -34,9 +34,12 @@ module ChartTernary = [] ?TextPosition : StyleParam.TextPosition, [] ?TextFont : Font, [] ?Dash : StyleParam.DrawingStyle, - [] ?Width : float + [] ?Width : float , + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true - ) = TraceTernary.initScatterTernary( TraceTernaryStyle.ScatterTernary( ?A = A, @@ -50,7 +53,7 @@ module ChartTernary = |> TraceStyle.Line(?Color=Color,?Dash=Dash,?Width=Width) |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults static member ScatterTernary ( @@ -66,8 +69,10 @@ module ChartTernary = [] ?TextPosition : StyleParam.TextPosition, [] ?TextFont : Font, [] ?Dash : StyleParam.DrawingStyle, - [] ?Width : float - ) = + [] ?Width : float , + [] ?UseDefaults : bool + ) = + let a,b,c = Seq.unzip3 abc Chart.ScatterTernary( A = a , @@ -84,7 +89,8 @@ module ChartTernary = ?TextPosition = TextPosition, ?TextFont = TextFont , ?Dash = Dash , - ?Width = Width + ?Width = Width , + ?UseDefaults = UseDefaults ) static member PointTernary @@ -100,8 +106,11 @@ module ChartTernary = [] ?Color : Color, [] ?Opacity : float, [] ?TextPosition : StyleParam.TextPosition, - [] ?TextFont : Font - ) = + [] ?TextFont : Font, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) @@ -117,7 +126,7 @@ module ChartTernary = |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults static member PointTernary ( @@ -129,9 +138,11 @@ module ChartTernary = [] ?Color : Color, [] ?Opacity : float, [] ?TextPosition : StyleParam.TextPosition, - [] ?TextFont : Font + [] ?TextFont : Font, + [] ?UseDefaults : bool + ) = - ) = + let useDefaults = defaultArg UseDefaults true let changeMode = StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome) let a,b,c = Seq.unzip3 abc @@ -146,7 +157,7 @@ module ChartTernary = |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults static member LineTernary ( @@ -164,8 +175,11 @@ module ChartTernary = [] ?Color : Color, [] ?Opacity : float, [] ?TextPosition : StyleParam.TextPosition, - [] ?TextFont : Font - ) = + [] ?TextFont : Font, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let changeMode = let isShowMarker = @@ -188,7 +202,7 @@ module ChartTernary = |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject + |> GenericChart.ofTraceObject useDefaults static member LineTernary ( @@ -203,8 +217,11 @@ module ChartTernary = [] ?Color : Color, [] ?Opacity : float, [] ?TextPosition : StyleParam.TextPosition, - [] ?TextFont : Font - ) = + [] ?TextFont : Font, + [] ?UseDefaults : bool + ) = + + let useDefaults = defaultArg UseDefaults true let a,b,c = Seq.unzip3 abc let changeMode = @@ -227,4 +244,4 @@ module ChartTernary = |> TraceStyle.TraceInfo(?Name=Name,?ShowLegend=ShowLegend,?Opacity=Opacity) |> TraceStyle.Marker(?Color=Color,?Symbol=MarkerSymbol) |> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont) - |> GenericChart.ofTraceObject \ No newline at end of file + |> GenericChart.ofTraceObject useDefaults \ No newline at end of file diff --git a/src/Plotly.NET/ChartAPI/GenericChart.fs b/src/Plotly.NET/ChartAPI/GenericChart.fs index 2e8fa1b83..727fb98c2 100644 --- a/src/Plotly.NET/ChartAPI/GenericChart.fs +++ b/src/Plotly.NET/ChartAPI/GenericChart.fs @@ -58,7 +58,7 @@ module HTML = //""" let chart = let newScript = new System.Text.StringBuilder() - newScript.AppendLine("""
""") |> ignore + newScript.AppendLine("""
""") |> ignore newScript.AppendLine("