Skip to content

Commit 39db77c

Browse files
committed
Add init functions for all currently available plotly trace types
1 parent 606d0c5 commit 39db77c

File tree

4 files changed

+165
-43
lines changed

4 files changed

+165
-43
lines changed

src/FSharp.Plotly/CandelstickExtension.fs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ type Candle =
2323
[<AutoOpen>]
2424
module CandelstickExtension =
2525

26-
module Trace =
27-
let initCandelstick (applyStyle:Trace->Trace) =
28-
FSharp.Plotly.Trace("candlestick") |> applyStyle
29-
30-
3126
type TraceStyle with
3227
[<CompiledName("Candlestick")>]
3328
static member Candlestick

src/FSharp.Plotly/SankeyExtension.fs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ type Link =
5151
[<AutoOpen>]
5252
module SankeyExtension =
5353

54-
module Trace =
55-
let initSankey (applyStyle:Trace->Trace) =
56-
FSharp.Plotly.Trace("sankey") |> applyStyle
57-
5854
type TraceStyle with
5955
[<CompiledName("Sankey")>]
6056
static member Sankey

src/FSharp.Plotly/Trace.fs

Lines changed: 142 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,71 +13,183 @@ type Trace (traceTypeName) =
1313

1414
[<CompilationRepresentationAttribute(CompilationRepresentationFlags.ModuleSuffix)>]
1515
module Trace =
16+
17+
18+
//Trace Types
1619

17-
/// Init trace for scatter plot
20+
//-------------------------------------------------------------------------------------------------------------------------------------------------
21+
//Simple
22+
23+
///initializes a trace of type "scatter" applying the givin trace styling function
1824
let initScatter (applyStyle:Trace->Trace) =
1925
Trace("scatter") |> applyStyle
2026

21-
/// Init trace for bar chart
27+
///initializes a trace of type "scattergl" applying the givin trace styling function
28+
let initScatterGL (applyStyle:Trace->Trace) =
29+
Trace("scattergl") |> applyStyle
30+
31+
///initializes a trace of type "bar" applying the givin trace styling function
2232
let initBar (applyStyle:Trace->Trace) =
2333
Trace("bar") |> applyStyle
2434

25-
/// Init trace for box plot
26-
let initBoxPlot (applyStyle:Trace->Trace) =
27-
Trace("box") |> applyStyle
28-
29-
/// Init trace for box plot
30-
let initViolin (applyStyle:Trace->Trace) =
31-
Trace("violin") |> applyStyle
32-
33-
/// Init trace for pie chart
35+
///initializes a trace of type "pie" applying the givin trace styling function
3436
let initPie (applyStyle:Trace->Trace) =
3537
Trace("pie") |> applyStyle
3638

37-
/// Init trace for Heatmap
39+
///initializes a trace of type "heatmap" applying the givin trace styling function
3840
let initHeatmap (applyStyle:Trace->Trace) =
3941
Trace("heatmap") |> applyStyle
4042

41-
/// Init trace for Contour
43+
///initializes a trace of type "image" applying the givin trace styling function
44+
let initImage (applyStyle:Trace->Trace) =
45+
Trace("image") |> applyStyle
46+
47+
///initializes a trace of type "contour" applying the givin trace styling function
4248
let initContour (applyStyle:Trace->Trace) =
4349
Trace("contour") |> applyStyle
4450

45-
/// Init trace for wind rose chart
46-
let initWindRose (applyStyle:Trace->Trace) =
47-
Trace("area") |> applyStyle
51+
///initializes a trace of type "Table" applying the givin trace styling function
52+
/// Init trace for table
53+
let initTable (applyStyle:Trace->Trace) =
54+
Trace("table") |> applyStyle
55+
56+
//-------------------------------------------------------------------------------------------------------------------------------------------------
57+
//Distributions
58+
59+
///initializes a trace of type "box" applying the givin trace styling function
60+
let initBoxPlot (applyStyle:Trace->Trace) =
61+
Trace("box") |> applyStyle
62+
63+
///initializes a trace of type "violin" applying the givin trace styling function
64+
let initViolin (applyStyle:Trace->Trace) =
65+
Trace("violin") |> applyStyle
4866

49-
/// Init trace for histogram
67+
///initializes a trace of type "histogram" applying the givin trace styling function
5068
let initHistogram (applyStyle:Trace->Trace) =
5169
Trace("histogram") |> applyStyle
5270

53-
/// Init trace for 2d-histogram
71+
///initializes a trace of type "histogram2d" applying the givin trace styling function
5472
let initHistogram2d (applyStyle:Trace->Trace) =
5573
Trace("histogram2d") |> applyStyle
5674

57-
/// Init trace for 2d-histogram contour
75+
///initializes a trace of type "histogram2dcontour" applying the givin trace styling function
5876
let initHistogram2dContour (applyStyle:Trace->Trace) =
5977
Trace("histogram2dcontour") |> applyStyle
6078

61-
/// Init trace for a parallel coordinates plot
62-
let initParallelCoord (applyStyle:Trace->Trace) =
63-
Trace("parcoords") |> applyStyle
79+
//-------------------------------------------------------------------------------------------------------------------------------------------------
80+
//Finance
6481

65-
// Init trace for a parallel category plot
66-
let initParallelCategories (applyStyle: Trace -> Trace) =
67-
Trace("parcats") |> applyStyle
82+
///initializes a trace of type "ohlc" applying the givin trace styling function
83+
let initOHLC (applyStyle:Trace->Trace) =
84+
Trace("ohlc") |> applyStyle
85+
86+
///initializes a trace of type "candlestick" applying the givin trace styling function
87+
let initCandlestick (applyStyle:Trace->Trace) =
88+
Trace("candlestick") |> applyStyle
89+
90+
///initializes a trace of type "waterfall" applying the givin trace styling function
91+
let initWaterfall (applyStyle:Trace->Trace) =
92+
Trace("waterfall") |> applyStyle
93+
94+
///initializes a trace of type "funnel" applying the givin trace styling function
95+
let initFunnel (applyStyle:Trace->Trace) =
96+
Trace("funnel") |> applyStyle
97+
98+
///initializes a trace of type "funnelarea" applying the givin trace styling function
99+
let initFunnelArea (applyStyle:Trace->Trace) =
100+
Trace("funnelarea") |> applyStyle
68101

69-
/// Init trace for a choropleth map
102+
///initializes a trace of type "indicator" applying the givin trace styling function
103+
let initIndicator (applyStyle:Trace->Trace) =
104+
Trace("indicator") |> applyStyle
105+
106+
//-------------------------------------------------------------------------------------------------------------------------------------------------
107+
//Maps
108+
109+
///initializes a trace of type "scattergeo" applying the givin trace styling function
110+
let initScatterGeo (applyStyle:Trace->Trace) =
111+
Trace("scattergeo") |> applyStyle
112+
113+
///initializes a trace of type "choropleth" applying the givin trace styling function
70114
let initChoroplethMap (applyStyle:Trace->Trace) =
71115
Trace("choropleth") |> applyStyle
72116

73-
/// Init trace for splom plot
117+
///initializes a trace of type "scattermapbox" applying the givin trace styling function
118+
let initScatterMapbox (applyStyle:Trace->Trace) =
119+
Trace("scattermapbox") |> applyStyle
120+
121+
///initializes a trace of type "choroplethmapbox" applying the givin trace styling function
122+
let initChoroplethMapbox (applyStyle:Trace->Trace) =
123+
Trace("choroplethmapbox") |> applyStyle
124+
125+
///initializes a trace of type "densitymapbox" applying the givin trace styling function
126+
let initDensityMapbox (applyStyle:Trace->Trace) =
127+
Trace("densitymapbox") |> applyStyle
128+
129+
//-------------------------------------------------------------------------------------------------------------------------------------------------
130+
//Specialized
131+
///initializes a trace of type "scatterpolar" applying the givin trace styling function
132+
let initScatterPolar (applyStyle:Trace->Trace) =
133+
Trace("scatterpolar") |> applyStyle
134+
135+
///initializes a trace of type "scatterpolargl" applying the givin trace styling function
136+
let initScatterPolarGL (applyStyle:Trace->Trace) =
137+
Trace("scatterpolargl") |> applyStyle
138+
139+
///initializes a trace of type "barpolar" applying the givin trace styling function
140+
let initBarPolar (applyStyle:Trace->Trace) =
141+
Trace("barpolar") |> applyStyle
142+
143+
///initializes a trace of type "scatterternary" applying the givin trace styling function
144+
let initScatterTernary (applyStyle:Trace->Trace) =
145+
Trace("scatterternary") |> applyStyle
146+
147+
///initializes a trace of type "sunburst" applying the givin trace styling function
148+
let initSunburst (applyStyle:Trace->Trace) =
149+
Trace("sunburst") |> applyStyle
150+
151+
///initializes a trace of type "treemap" applying the givin trace styling function
152+
let initTreemap (applyStyle:Trace->Trace) =
153+
Trace("treemap") |> applyStyle
154+
155+
///initializes a trace of type "sankey" applying the givin trace styling function
156+
let initSankey (applyStyle:Trace->Trace) =
157+
Trace("sankey") |> applyStyle
158+
159+
///initializes a trace of type "SPLOM" applying the givin trace styling function
74160
let initSplom (applyStyle:Trace->Trace) =
75161
Trace("splom") |> applyStyle
76162

77-
/// Init trace for table
78-
let initTable (applyStyle:Trace->Trace) =
79-
Trace("table") |> applyStyle
163+
///initializes a trace of type "parcoords" applying the givin trace styling function
164+
let initParallelCoord (applyStyle:Trace->Trace) =
165+
Trace("parcoords") |> applyStyle
166+
167+
///initializes a trace of type "parcats" applying the givin trace styling function
168+
let initParallelCategories (applyStyle: Trace -> Trace) =
169+
Trace("parcats") |> applyStyle
170+
171+
///initializes a trace of type "carpet" applying the givin trace styling function
172+
let initCarpet (applyStyle:Trace->Trace) =
173+
Trace("carpet") |> applyStyle
174+
175+
///initializes a trace of type "scattercarpet" applying the givin trace styling function
176+
let initScatterCarpet (applyStyle:Trace->Trace) =
177+
Trace("scattercarpet") |> applyStyle
178+
179+
///initializes a trace of type "contourcarpet" applying the givin trace styling function
180+
let initContourCarpet (applyStyle:Trace->Trace) =
181+
Trace("contourcarpet") |> applyStyle
182+
183+
184+
185+
//-------------------------------------------------------------------------------------------------------------------------------------------------
186+
//Custom
187+
188+
/// Init trace for wind rose chart
189+
let initWindRose (applyStyle:Trace->Trace) =
190+
Trace("area") |> applyStyle
80191

192+
//-------------------------------------------------------------------------------------------------------------------------------------------------
81193
/// Functions provide the styling of the Chart objects
82194
type TraceStyle() =
83195

src/FSharp.Plotly/Trace3d.fs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,40 @@ type Trace3d (traceTypeName) =
1010

1111
[<CompilationRepresentationAttribute(CompilationRepresentationFlags.ModuleSuffix)>]
1212
module Trace3d =
13+
//TO-DO: we need to think about if all subgroups of traces should be seperate, e.g. also "TraceFinance" or leave it at the current separation
14+
//-------------------------------------------------------------------------------------------------------------------------------------------------
15+
//3D
1316

14-
/// Init trace for 3d-scatter plot
17+
///initializes a trace of type "scatter3d" applying the givin trace styling function
1518
let initScatter3d (applyStyle:Trace3d->Trace3d) =
1619
Trace3d("scatter3d") |> applyStyle
1720

18-
/// Init trace for 3d-contour plot
21+
///initializes a trace of type "surface" applying the givin trace styling function
1922
let initSurface (applyStyle:Trace3d->Trace3d) =
2023
Trace3d("surface") |> applyStyle
21-
22-
/// Init trace for 3d-mesh plot
24+
25+
///initializes a trace of type "mesh3d" applying the givin trace styling function
2326
let initMesh3d (applyStyle:Trace3d->Trace3d) =
2427
Trace3d("mesh3d") |> applyStyle
2528

29+
///initializes a trace of type "cone" applying the givin trace styling function
30+
let initCone (applyStyle:Trace3d->Trace3d) =
31+
Trace3d("cone") |> applyStyle
32+
33+
///initializes a trace of type "streamtube" applying the givin trace styling function
34+
let initStreamTube (applyStyle:Trace3d->Trace3d) =
35+
Trace3d("streamtube") |> applyStyle
36+
37+
///initializes a trace of type "volume" applying the givin trace styling function
38+
let initVolume (applyStyle:Trace3d->Trace3d) =
39+
Trace3d("volume") |> applyStyle
40+
41+
///initializes a trace of type "isosurface" applying the givin trace styling function
42+
let initIsoSurface (applyStyle:Trace3d->Trace3d) =
43+
Trace3d("isosurface") |> applyStyle
2644

2745

46+
//-------------------------------------------------------------------------------------------------------------------------------------------------
2847
/// Functions provide the styling of the Chart objects
2948
type Trace3dStyle() =
3049

0 commit comments

Comments
 (0)