File tree 2 files changed +57
-3
lines changed
2 files changed +57
-3
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,30 @@ open FSharpAux
161
161
open System
162
162
open System.IO
163
163
164
+ let layout =
165
+ Layout.init ( Font = Font.init ( Family = StyleParam.FontFamily.Raleway, Size = 14. ))
166
+
167
+ let traceTemplates = [
168
+ Trace2D.initScatter (
169
+ Trace2DStyle.Scatter( Marker = Marker.init ( Symbol = StyleParam.MarkerSymbol.Diamond, Size = 20 ))
170
+ )
171
+ Trace2D.initScatter (
172
+ Trace2DStyle.Scatter( Marker = Marker.init ( Symbol = StyleParam.MarkerSymbol.ArrowBarLeft, Size = 10 ))
173
+ )
174
+ ]
175
+
176
+ let template = Template.init ( layout, traceTemplates)
177
+
178
+ [
179
+ Chart.Scatter( x = [ 0 ; 1 ; 2 ], y = [ 2 ; 1 ; 3 ], mode = StyleParam.Mode.Markers)
180
+ Chart.Scatter( x = [ 0 ; 1 ; 2 ], y = [ 1 ; 2 ; 4 ], mode = StyleParam.Mode.Markers)
181
+ ]
182
+ |> Chart.combine
183
+ |> Chart.withLayout ( Layout.init ( Title = Title.init ( " Figure Title" )))
184
+ |> Chart.withTemplate template
185
+ //|> GenericChart.mapTrace (fun t -> t.Remove("marker"); t)
186
+ |> Chart.show
187
+
164
188
let y = [ 2.37 ; 2.16 ; 4.82 ; 1.73 ; 1.04 ; 0.23 ; 1.32 ; 2.91 ; 0.11 ; 4.51 ; 0.51 ; 3.75 ; 1.35 ; 2.98 ; 4.50 ; 0.18 ; 4.66 ; 1.30 ; 2.06 ; 1.19 ]
165
189
166
190
[
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ type Template() =
12
12
static member init
13
13
(
14
14
layoutTemplate : Layout ,
15
- [<Optional; DefaultParameterValue( null ) >] ? TraceTemplates : #Trace []
15
+ [<Optional; DefaultParameterValue( null ) >] ? TraceTemplates : seq < #Trace >
16
16
) =
17
17
Template()
18
18
|> Template.style
@@ -24,11 +24,41 @@ type Template() =
24
24
static member style
25
25
(
26
26
layoutTemplate : Layout ,
27
- [<Optional; DefaultParameterValue( null ) >] ? TraceTemplates : #Trace []
27
+ [<Optional; DefaultParameterValue( null ) >] ? TraceTemplates : seq < #Trace >
28
28
) =
29
29
( fun ( template : Template ) ->
30
+
31
+ let traceTemplates =
32
+ TraceTemplates
33
+ |> Option.map ( fun traceTemplates ->
34
+ traceTemplates
35
+ |> Seq.groupBy ( fun t -> t.`` type `` )
36
+ |> ( fun groupedTemplates ->
37
+ groupedTemplates
38
+ |> Seq.map ( fun ( id , templates ) ->
39
+ id,
40
+ templates
41
+ |> Seq.map ( fun t ->
42
+ let tmp = DynamicObj()
43
+ t.CopyDynamicPropertiesTo( tmp)
44
+ tmp
45
+ )
46
+
47
+ )
48
+ )
49
+ )
50
+ |> fun traceTemplates ->
51
+ let tmp = DynamicObj()
52
+ traceTemplates
53
+ |> Option.iter ( Seq.iter ( fun ( id , traceTemplate ) ->
54
+ traceTemplate |> DynObj.setValue tmp id
55
+ )
56
+ )
57
+ tmp
58
+
59
+
30
60
layoutTemplate |> DynObj.setValue template " layout"
31
- TraceTemplates |> DynObj.setValueOpt template " data"
61
+ traceTemplates |> DynObj.setValue template " data"
32
62
33
63
template
34
64
)
You can’t perform that action at this time.
0 commit comments