11module ChartDomainTestCharts
22
33open Plotly.NET
4+ open Plotly.NET .TraceObjects
45
56module Pie =
67
@@ -82,15 +83,175 @@ module FunnelArea =
8283 UseDefaults = false
8384 )
8485
85- module Sunburst = ()
86+ module Sunburst =
8687
87- module Treemap = ()
88+
89+ let ``Simple sunburst chart`` =
90+ Chart.Sunburst(
91+ labels = [ " A" ; " B" ; " C" ; " D" ; " E" ],
92+ parents = [ " " ; " " ; " B" ; " B" ; " " ],
93+ Values=[ 5. ; 0. ; 3. ; 2. ; 3. ],
94+ MultiText=[ " At" ; " Bt" ; " Ct" ; " Dt" ; " Et" ],
95+ UseDefaults = false
96+ )
97+
98+ let ``Styled sunburst chart`` =
99+ let labelsParents = [
100+ ( " A" , " " ), 20
101+ ( " B" , " " ), 1
102+ ( " C" , " " ), 2
103+ ( " D" , " " ), 3
104+ ( " E" , " " ), 4
105+
106+ ( " AA" , " A" ), 15
107+ ( " AB" , " A" ), 5
108+
109+ ( " BA" , " B" ), 1
110+
111+ ( " AAA" , " AA" ), 10
112+ ( " AAB" , " AA" ), 5
113+ ]
114+
115+ Chart.Sunburst(
116+ labelsparents = ( labelsParents |> Seq.map fst),
117+ Values = ( labelsParents |> Seq.map snd),
118+ BranchValues = StyleParam.BranchValues.Total, // branch values are the total of their childrens values
119+ SectionColorScale = StyleParam.Colorscale.Viridis,
120+ ShowSectionColorScale = true ,
121+ SectionOutlineColor = Color.fromKeyword Black,
122+ Rotation = 45 ,
123+ UseDefaults = false
124+ )
125+
126+ module Treemap =
127+
128+
129+ let ``Styled treemap chart`` =
130+ let labelsParents = [
131+ ( " A" , " " ), 20
132+ ( " B" , " " ), 1
133+ ( " C" , " " ), 2
134+ ( " D" , " " ), 3
135+ ( " E" , " " ), 4
136+
137+ ( " AA" , " A" ), 15
138+ ( " AB" , " A" ), 5
139+
140+ ( " BA" , " B" ), 1
141+
142+ ( " AAA" , " AA" ), 10
143+ ( " AAB" , " AA" ), 5
144+ ]
145+
146+ Chart.Treemap(
147+ labelsparents = ( labelsParents |> Seq.map fst),
148+ Values = ( labelsParents |> Seq.map snd),
149+ BranchValues = StyleParam.BranchValues.Total, // branch values are the total of their childrens values
150+ SectionColorScale = StyleParam.Colorscale.Viridis,
151+ ShowSectionColorScale = true ,
152+ SectionOutlineColor = Color.fromKeyword Black,
153+ Tiling = TreemapTiling.init( Packing = StyleParam.TreemapTilingPacking.SliceDice),
154+ UseDefaults = false
155+ )
156+
157+ module ParallelCoord =
158+
159+ let ``Simple parallel coordinates chart`` =
160+ let data =
161+ [
162+ " A" ,[ 1. ; 4. ; 3.4 ; 0.7 ;]
163+ " B" ,[ 3. ; 1.5 ; 1.7 ; 2.3 ;]
164+ " C" ,[ 2. ; 4. ; 3.1 ; 5. ]
165+ " D" ,[ 4. ; 2. ; 2. ; 4. ;]
166+ ]
167+ Chart.ParallelCoord( keyValues = data, LineColor= Color.fromString " blue" , UseDefaults = false )
168+
169+ let ``Styled parallel coordinates chart`` =
170+
171+ let dims =
172+ [
173+ Dimension.initParallel( Label = " 1" , Values = ([ 1 ; 2 ; 3 ; 4 ] ), Range = StyleParam.Range.MinMax( 0. , 8. ))
174+ Dimension.initParallel( Label = " 2" , Values = ([ 1 ; 2 ; 3 ; 4 ] |> List.rev ), Range = StyleParam.Range.MinMax( 0. , 8. ))
175+ Dimension.initParallel( Label = " 3" , Values = ([ 1 ; 2 ; 3 ; 4 ] ), Range = StyleParam.Range.MinMax( 0. , 8. ))
176+ Dimension.initParallel( Label = " 4" , Values = ([ 1 ; 2 ; 3 ; 4 ] |> List.rev ), Range = StyleParam.Range.MinMax( 0. , 8. ))
177+ ]
178+
179+ let colors =
180+ [ 1 ; 2 ; 3 ; 4 ]
181+ |> Color.fromColorScaleValues
182+
183+ Chart.ParallelCoord(
184+ dimensions = dims,
185+ LineColorScale = StyleParam.Colorscale.Viridis,
186+ LineColor = colors,
187+ UseDefaults = false
188+ )
189+
190+ module ParallelCategories =
191+
192+ let ``Simple parallel categories chart`` =
193+ let dims =
194+ [
195+ Dimension.initParallel( Values = [ " Cat1" ; " Cat1" ; " Cat1" ; " Cat1" ; " Cat2" ; " Cat2" ; " Cat3" ], Label= " A" )
196+ Dimension.initParallel( Values = [ 0 ; 1 ; 0 ; 1 ; 0 ; 0 ; 0 ], Label= " B" , TickText=[ " YES" ; " NO" ])
197+ ]
198+
199+ Chart.ParallelCategories(
200+ dimensions = dims,
201+ LineColor= Color.fromColorScaleValues [ 0. ; 1. ; 0. ; 1. ; 0. ; 0. ; 0. ],
202+ LineColorScale = StyleParam.Colorscale.Blackbody,
203+ UseDefaults = false
204+ )
205+
206+ let ``Styled parallel categories chart`` =
207+ let dims =
208+ [
209+ Dimension.initParallel( Values = [ " A" ; " A" ; " A" ; " B" ; " B" ; " B" ; " C" ; " D" ], Label= " Lvl1" )
210+ Dimension.initParallel( Values = [ " AA" ; " AA" ; " AB" ; " AB" ; " AB" ; " AB" ; " AB" ; " AB" ], Label= " Lvl2" )
211+ Dimension.initParallel( Values = [ " AAA" ; " AAB" ; " AAC" ; " AAC" ; " AAB" ; " AAB" ; " AAA" ; " AAA" ], Label= " Lvl3" )
212+ ]
88213
89- module ParralelCoord = ()
214+ Chart.ParallelCategories(
215+ dimensions = dims,
216+ LineColor = Color.fromColorScaleValues [ 0 ; 1 ; 2 ; 2 ; 1 ; 1 ; 0 ; 0 ], // These values map to the last category axis, meaning [AAA => 0; AAB = 1; AAC => 2]
217+ LineColorScale = StyleParam.Colorscale.Viridis,
218+ BundleColors = false ,
219+ UseDefaults = false
220+ )
90221
91- module ParralelCategories = ()
222+ module Sankey =
223+
224+ let ``Styled sankey chart`` =
225+ Chart.Sankey(
226+ nodeLabels = [ " A1" ; " A2" ; " B1" ; " B2" ; " C1" ; " C2" ; " D1" ],
227+ linkedNodeIds = [
228+ 0 , 2
229+ 0 , 3
230+ 1 , 3
231+ 2 , 4
232+ 3 , 4
233+ 3 , 5
234+ 4 , 6
235+ 5 , 6
236+ ],
237+ NodeOutlineColor = Color.fromKeyword Black,
238+ NodeOutlineWidth = 1. ,
239+ linkValues = [ 8 ; 4 ; 2 ; 7 ; 3 ; 2 ; 5 ; 2 ],
240+ LinkColor = Color.fromColors [
241+ Color.fromHex " #828BFB"
242+ Color.fromHex " #828BFB"
243+ Color.fromHex " #F27762"
244+ Color.fromHex " #33D6AB"
245+ Color.fromHex " #BC82FB"
246+ Color.fromHex " #BC82FB"
247+ Color.fromHex " #FFB47B"
248+ Color.fromHex " #47DCF5"
249+ ],
250+ LinkOutlineColor = Color.fromKeyword Black,
251+ LinkOutlineWidth = 1. ,
252+ UseDefaults = false
253+ )
92254
93- module Sankey = ()
94255
95256module Table =
96257
@@ -277,4 +438,44 @@ module Indicator =
277438 )
278439
279440
280- module Icicle = ()
441+ module Icicle =
442+
443+ let ``Simple icicle chart`` =
444+ Chart.Icicle(
445+ labels = [ " Eve" ; " Cain" ; " Seth" ; " Enos" ; " Noam" ; " Abel" ; " Awan" ; " Enoch" ; " Azura" ],
446+ parents = [ " " ; " Eve" ; " Eve" ; " Seth" ; " Seth" ; " Eve" ; " Eve" ; " Awan" ; " Eve" ],
447+ ShowSectionColorScale = true ,
448+ SectionColorScale = StyleParam.Colorscale.Viridis,
449+ TilingOrientation = StyleParam.Orientation.Vertical,
450+ TilingFlip = StyleParam.TilingFlip.Y,
451+ PathBarEdgeShape = StyleParam.PathbarEdgeShape.BackSlash,
452+ UseDefaults = false
453+ )
454+
455+ let ``Styled icicle chart`` =
456+ let labelsParents = [
457+ ( " A" , " " ), 20
458+ ( " B" , " " ), 1
459+ ( " C" , " " ), 2
460+ ( " D" , " " ), 3
461+ ( " E" , " " ), 4
462+
463+ ( " AA" , " A" ), 15
464+ ( " AB" , " A" ), 5
465+
466+ ( " BA" , " B" ), 1
467+
468+ ( " AAA" , " AA" ), 10
469+ ( " AAB" , " AA" ), 5
470+ ]
471+
472+ Chart.Icicle(
473+ labelsparents = ( labelsParents |> Seq.map fst),
474+ Values = ( labelsParents |> Seq.map snd),
475+ BranchValues = StyleParam.BranchValues.Total, // branch values are the total of their childrens values
476+ SectionColorScale = StyleParam.Colorscale.Viridis,
477+ ShowSectionColorScale = true ,
478+ SectionOutlineColor = Color.fromKeyword Black,
479+ Tiling = IcicleTiling.init( Flip = StyleParam.TilingFlip.XY),
480+ UseDefaults = false
481+ )
0 commit comments