@@ -9,6 +9,172 @@ open System.Runtime.InteropServices
99
1010module ChartTemplates =
1111
12+ /// A colorway is an array of colors that contains the default colors for traces
13+ module ColorWays =
14+
15+ let plotly = Color.fromColors[|
16+ Color.fromHex " #636efa"
17+ Color.fromHex " #EF553B"
18+ Color.fromHex " #00cc96"
19+ Color.fromHex " #ab63fa"
20+ Color.fromHex " #FFA15A"
21+ Color.fromHex " #19d3f3"
22+ Color.fromHex " #FF6692"
23+ Color.fromHex " #B6E880"
24+ Color.fromHex " #FF97FF"
25+ Color.fromHex " #FECB52"
26+ |]
27+
28+ let fslab = Color.fromColors[|
29+ Color.fromHex " #A00975" // darkmagenta
30+ Color.fromHex " #D12F67" // rose
31+ Color.fromHex " #44d57f" // green
32+ Color.fromHex " #438AFE" // aquamarine
33+ Color.fromHex " #d59a1b" // dark yellow
34+ Color.fromHex " #F99BDE" // lightmagenta
35+ Color.fromHex " #ff9b9b" // light rose
36+ Color.fromHex " #c6ffdd" // light green
37+ Color.fromHex " #00d4ff" // light aquamarine
38+ Color.fromHex " #d2c572" // yellow
39+ |]
40+
41+ let light =
42+ let initLightAxisTemplate () =
43+ LinearAxis.init(
44+ ShowLine = true ,
45+ ZeroLine = true
46+ )
47+
48+ let defaultLayout =
49+ Layout.init (
50+ PaperBGColor = Color.fromString " white" ,
51+ PlotBGColor = Color.fromString " white"
52+ )
53+ |> Layout.AddLinearAxis(( StyleParam.SubPlotId.XAxis 1 ),( initLightAxisTemplate()))
54+ |> Layout.AddLinearAxis(( StyleParam.SubPlotId.YAxis 1 ),( initLightAxisTemplate()))
55+
56+ Template.init( defaultLayout)
57+
58+ let lightMirrored =
59+ let initLightAxisTemplate () =
60+ LinearAxis.init(
61+ ShowLine = true ,
62+ ZeroLine = true ,
63+ Mirror = StyleParam.Mirror.All,
64+ Ticks = StyleParam.TickOptions.Inside
65+ //Showgrid = false
66+ )
67+
68+ let defaultLayout =
69+ Layout.init (
70+ PaperBGColor = Color.fromString " white" ,
71+ PlotBGColor = Color.fromString " white"
72+ )
73+ |> Layout.AddLinearAxis(( StyleParam.SubPlotId.XAxis 1 ),( initLightAxisTemplate()))
74+ |> Layout.AddLinearAxis(( StyleParam.SubPlotId.YAxis 1 ),( initLightAxisTemplate()))
75+
76+ Template.init( defaultLayout)
77+
78+ let dark =
79+
80+ let initDarkAxisTemplate () =
81+ LinearAxis.init(
82+ LineColor = Color.fromString " rgb(204, 204, 204)" ,
83+ ZeroLineColor = Color.fromString " rgb(204, 204, 204)" ,
84+ GridColor = Color.fromString " rgba(204, 204, 204, 0.3)" ,
85+ TickColor = Color.fromString" rgba(204, 204, 204, 0.5)" ,
86+ Ticks = StyleParam.TickOptions.Inside,
87+ ShowLine = true ,
88+ ZeroLine = true
89+ )
90+
91+ let darkLayoutTemplate =
92+ Layout.init(
93+ PaperBGColor = Color.fromString " rgb(55, 55, 61)" ,
94+ PlotBGColor= Color.fromString " rgb(55, 55, 61)" ,
95+ Font = Font.init( Color = Color.fromString " rgb(204, 204, 204)" )
96+ )
97+ |> Layout.AddLinearAxis(( StyleParam.SubPlotId.XAxis 1 ),( initDarkAxisTemplate()))
98+ |> Layout.AddLinearAxis(( StyleParam.SubPlotId.YAxis 1 ),( initDarkAxisTemplate()))
99+
100+ Template.init( darkLayoutTemplate)
101+
102+ let darkMirrored =
103+ dark
104+ |> Template.mapLayoutTemplate ( fun l ->
105+ l.TryGetTypedValue< LinearAxis>( " xaxis" )
106+ |> Option.map ( LinearAxis.style ( Mirror= StyleParam.Mirror.AllTicks))
107+ |> DynObj.setValueOpt l " xaxis"
108+
109+ l.TryGetTypedValue< LinearAxis>( " yaxis" )
110+ |> Option.map ( LinearAxis.style ( Mirror= StyleParam.Mirror.AllTicks))
111+ |> DynObj.setValueOpt l " yaxis"
112+
113+ l
114+ )
115+
116+ let fslab =
117+
118+ let initFslabAxisTemplate () =
119+ LinearAxis.init(
120+ LineColor = Color.fromString " white" ,
121+ ZeroLineColor = Color.fromString" rgba(67, 138, 254, 0.5)" ,
122+ GridColor = Color.fromString " rgba(67, 138, 254, 0.5)" ,
123+ TickColor = Color.fromString " rgba(67, 138, 254, 0.5)" ,
124+ Ticks = StyleParam.TickOptions.Inside,
125+ ShowLine = true ,
126+ ZeroLine = true
127+ )
128+
129+ let fslabLayoutTemplate =
130+ Layout.init(
131+ PaperBGColor = Color.fromString " #200117" ,
132+ PlotBGColor = Color.fromString " #200117" ,
133+ Font = Font.init( Color = Color.fromString " white" )
134+ )
135+ |> Layout.AddLinearAxis(( StyleParam.SubPlotId.XAxis 1 ),( initFslabAxisTemplate()))
136+ |> Layout.AddLinearAxis(( StyleParam.SubPlotId.YAxis 1 ),( initFslabAxisTemplate()))
137+
138+ Template.init( fslabLayoutTemplate)
139+ |> Template.withColorWay ColorWays.fslab
140+
141+
142+ let transparent =
143+ let initTransparentAxisTemplate () =
144+ LinearAxis.init(
145+ ShowLine = true ,
146+ ZeroLine = true
147+ )
148+
149+ let defaultLayout =
150+ Layout.init (
151+ PaperBGColor = Color.fromString " rgba(255, 255, 255, 0)" ,
152+ PlotBGColor = Color.fromString " rgba(255, 255, 255, 0)"
153+ )
154+ |> Layout.AddLinearAxis(( StyleParam.SubPlotId.XAxis 1 ),( initTransparentAxisTemplate()))
155+ |> Layout.AddLinearAxis(( StyleParam.SubPlotId.YAxis 1 ),( initTransparentAxisTemplate()))
156+
157+ Template.init( defaultLayout)
158+
159+ let transparentMirrored =
160+ let initTransparentAxisTemplate () =
161+ LinearAxis.init(
162+ ShowLine = true ,
163+ ZeroLine = true ,
164+ Mirror = StyleParam.Mirror.All,
165+ Ticks = StyleParam.TickOptions.Inside
166+ )
167+
168+ let defaultLayout =
169+ Layout.init (
170+ PaperBGColor = Color.fromString " rgba(255, 255, 255, 0)" ,
171+ PlotBGColor = Color.fromString " rgba(255, 255, 255, 0)"
172+ )
173+ |> Layout.AddLinearAxis(( StyleParam.SubPlotId.XAxis 1 ),( initTransparentAxisTemplate()))
174+ |> Layout.AddLinearAxis(( StyleParam.SubPlotId.YAxis 1 ),( initTransparentAxisTemplate()))
175+
176+ Template.init( defaultLayout)
177+
12178 /// the default template, as used in the python lib by default.
13179 let plotly =
14180
@@ -454,4 +620,4 @@ module ChartTemplates =
454620 ]
455621
456622 Template.init( layoutTempplate, traceTemplates)
457- |> Template.withColorWay ChartTemplates. ColorWays.plotly
623+ |> Template.withColorWay ColorWays.plotly
0 commit comments