Skip to content

Commit fe9ef2e

Browse files
committed
Properly document Layout, Refactor some Chart APIs
1 parent 7a8a56f commit fe9ef2e

File tree

8 files changed

+645
-159
lines changed

8 files changed

+645
-159
lines changed

src/Plotly.NET.ImageExport/Plotly.NET.ImageExport.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
</ItemGroup>
3838

3939
<ItemGroup>
40-
<PackageReference Include="DynamicObj" Version="0.2.0" />
40+
<PackageReference Include="DynamicObj" Version="1.0.1" />
4141
<PackageReference Include="PuppeteerSharp" Version="6.0.0" />
4242
</ItemGroup>
4343

src/Plotly.NET/CSharpLayer/GenericChartExtensions.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ module GenericChartExtensions =
606606
[<Extension>]
607607
member this.WithLayoutGrid(layoutGrid: LayoutGrid) =
608608
let layout =
609-
GenericChart.getLayout this |> Layout.SetLayoutGrid layoutGrid
609+
GenericChart.getLayout this |> Layout.setLayoutGrid layoutGrid
610610

611611
GenericChart.setLayout layout this
612612

@@ -831,7 +831,7 @@ module GenericChartExtensions =
831831
) in
832832

833833
let updatedLayout =
834-
layout |> Layout.SetLayoutGrid updatedGrid in
834+
layout |> Layout.setLayoutGrid updatedGrid in
835835

836836
GenericChart.setLayout updatedLayout this
837837

src/Plotly.NET/ChartAPI/Chart.fs

Lines changed: 193 additions & 71 deletions
Large diffs are not rendered by default.

src/Plotly.NET/CommonAbstractions/StyleParams.fs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3130,6 +3130,20 @@ module StyleParam =
31303130
override this.ToString() = this |> TraceItemClickOptions.toString
31313131
member this.Convert() = this |> TraceItemClickOptions.convert
31323132

3133+
[<RequireQualifiedAccess>]
3134+
type TraceGroupClickOptions =
3135+
| ToggleItem
3136+
| ToggleGroup
3137+
3138+
static member toString =
3139+
function
3140+
| Toggle -> "toggleitem"
3141+
| ToggleGroup -> "togglegroup"
3142+
3143+
static member convert = TraceGroupClickOptions.toString >> box
3144+
override this.ToString() = this |> TraceGroupClickOptions.toString
3145+
member this.Convert() = this |> TraceGroupClickOptions.convert
3146+
31333147
[<RequireQualifiedAccess>]
31343148
type TickLabelMode =
31353149
| Instant

src/Plotly.NET/Layout/Layout.fs

Lines changed: 319 additions & 31 deletions
Large diffs are not rendered by default.

src/Plotly.NET/Layout/ObjectAbstractions/Common/Legend.fs

Lines changed: 98 additions & 36 deletions
Large diffs are not rendered by default.

src/Plotly.NET/Templates/ChartTemplates.fs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ module ChartTemplates =
4242

4343
let defaultLayout =
4444
Layout.init (PaperBGColor = Color.fromString "white", PlotBGColor = Color.fromString "white")
45-
|> Layout.AddLinearAxis((StyleParam.SubPlotId.XAxis 1), (initLightAxisTemplate ()))
46-
|> Layout.AddLinearAxis((StyleParam.SubPlotId.YAxis 1), (initLightAxisTemplate ()))
45+
|> Layout.addLinearAxis ((StyleParam.SubPlotId.XAxis 1), (initLightAxisTemplate ()))
46+
|> Layout.addLinearAxis ((StyleParam.SubPlotId.YAxis 1), (initLightAxisTemplate ()))
4747

4848
Template.init (defaultLayout)
4949

@@ -59,8 +59,8 @@ module ChartTemplates =
5959

6060
let defaultLayout =
6161
Layout.init (PaperBGColor = Color.fromString "white", PlotBGColor = Color.fromString "white")
62-
|> Layout.AddLinearAxis((StyleParam.SubPlotId.XAxis 1), (initLightAxisTemplate ()))
63-
|> Layout.AddLinearAxis((StyleParam.SubPlotId.YAxis 1), (initLightAxisTemplate ()))
62+
|> Layout.addLinearAxis ((StyleParam.SubPlotId.XAxis 1), (initLightAxisTemplate ()))
63+
|> Layout.addLinearAxis ((StyleParam.SubPlotId.YAxis 1), (initLightAxisTemplate ()))
6464

6565
Template.init (defaultLayout)
6666

@@ -83,8 +83,8 @@ module ChartTemplates =
8383
PlotBGColor = Color.fromString "rgb(55, 55, 61)",
8484
Font = Font.init (Color = Color.fromString "rgb(204, 204, 204)")
8585
)
86-
|> Layout.AddLinearAxis((StyleParam.SubPlotId.XAxis 1), (initDarkAxisTemplate ()))
87-
|> Layout.AddLinearAxis((StyleParam.SubPlotId.YAxis 1), (initDarkAxisTemplate ()))
86+
|> Layout.addLinearAxis ((StyleParam.SubPlotId.XAxis 1), (initDarkAxisTemplate ()))
87+
|> Layout.addLinearAxis ((StyleParam.SubPlotId.YAxis 1), (initDarkAxisTemplate ()))
8888

8989
Template.init (darkLayoutTemplate)
9090

@@ -121,8 +121,8 @@ module ChartTemplates =
121121
PlotBGColor = Color.fromString "#200117",
122122
Font = Font.init (Color = Color.fromString "white")
123123
)
124-
|> Layout.AddLinearAxis((StyleParam.SubPlotId.XAxis 1), (initFslabAxisTemplate ()))
125-
|> Layout.AddLinearAxis((StyleParam.SubPlotId.YAxis 1), (initFslabAxisTemplate ()))
124+
|> Layout.addLinearAxis ((StyleParam.SubPlotId.XAxis 1), (initFslabAxisTemplate ()))
125+
|> Layout.addLinearAxis ((StyleParam.SubPlotId.YAxis 1), (initFslabAxisTemplate ()))
126126

127127
Template.init (fslabLayoutTemplate) |> Template.withColorWay ColorWays.fslab
128128

@@ -136,8 +136,8 @@ module ChartTemplates =
136136
PaperBGColor = Color.fromString "rgba(255, 255, 255, 0)",
137137
PlotBGColor = Color.fromString "rgba(255, 255, 255, 0)"
138138
)
139-
|> Layout.AddLinearAxis((StyleParam.SubPlotId.XAxis 1), (initTransparentAxisTemplate ()))
140-
|> Layout.AddLinearAxis((StyleParam.SubPlotId.YAxis 1), (initTransparentAxisTemplate ()))
139+
|> Layout.addLinearAxis ((StyleParam.SubPlotId.XAxis 1), (initTransparentAxisTemplate ()))
140+
|> Layout.addLinearAxis ((StyleParam.SubPlotId.YAxis 1), (initTransparentAxisTemplate ()))
141141

142142
Template.init (defaultLayout)
143143

@@ -155,8 +155,8 @@ module ChartTemplates =
155155
PaperBGColor = Color.fromString "rgba(255, 255, 255, 0)",
156156
PlotBGColor = Color.fromString "rgba(255, 255, 255, 0)"
157157
)
158-
|> Layout.AddLinearAxis((StyleParam.SubPlotId.XAxis 1), (initTransparentAxisTemplate ()))
159-
|> Layout.AddLinearAxis((StyleParam.SubPlotId.YAxis 1), (initTransparentAxisTemplate ()))
158+
|> Layout.addLinearAxis ((StyleParam.SubPlotId.XAxis 1), (initTransparentAxisTemplate ()))
159+
|> Layout.addLinearAxis ((StyleParam.SubPlotId.YAxis 1), (initTransparentAxisTemplate ()))
160160

161161
Template.init (defaultLayout)
162162

@@ -228,7 +228,7 @@ module ChartTemplates =
228228
StyleParam.SubPlotId.ColorAxis 1,
229229
ColorAxis.init (ColorBar = ColorBar.init (OutlineWidth = 0., Ticks = StyleParam.TickOptions.Empty))
230230
)
231-
|> Layout.UpdateGeoById(
231+
|> Layout.updateGeoById (
232232
StyleParam.SubPlotId.Geo 1,
233233
Geo.init (
234234
BgColor = Color.fromKeyword White,
@@ -239,7 +239,7 @@ module ChartTemplates =
239239
SubunitColor = Color.fromKeyword White
240240
)
241241
)
242-
|> Layout.UpdateMapboxById(
242+
|> Layout.updateMapboxById (
243243
StyleParam.SubPlotId.Mapbox 1,
244244
Mapbox.init (Style = StyleParam.MapboxStyle.MapboxLight)
245245
)
@@ -320,7 +320,7 @@ module ChartTemplates =
320320
BGColor = Color.fromHex "#E5ECF6"
321321
)
322322
)
323-
|> Layout.UpdateLinearAxisById(
323+
|> Layout.updateLinearAxisById (
324324
StyleParam.SubPlotId.XAxis 1,
325325
LinearAxis.init (
326326
AutoMargin = true,
@@ -332,7 +332,7 @@ module ChartTemplates =
332332
ZeroLineWidth = 2.
333333
)
334334
)
335-
|> Layout.UpdateLinearAxisById(
335+
|> Layout.updateLinearAxisById (
336336
StyleParam.SubPlotId.YAxis 1,
337337
LinearAxis.init (
338338
AutoMargin = true,

src/Plotly.NET/Traces/Trace.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,10 @@ type Trace(traceTypeName: string) =
169169
trace)
170170

171171
//-------------------------------------------------------------------------------------------------------------------------------------------------
172-
/// Contains general, visualization-unspecific functions to style Trace Objects.
172+
/// Contains general, visualization-unspecific functions to style Trace objects.
173173
///
174174
/// These functions are used internally to style traces of Chart objects.
175-
/// Users should usually be pointed to the API layer provided by the `Chart` module/object
175+
/// Users should usually be pointed to the API layer provided by the `Chart` module/object first.
176176
///
177177
/// Visualization-specific equivalents are suffixed with the respective trace subtype, e.g. `TraceStyle2D`
178178
type TraceStyle() =

0 commit comments

Comments
 (0)