@@ -58,14 +58,119 @@ type Margin() =
58
58
)
59
59
60
60
61
- /// Margin
61
+ /// Text annotations inside a plot
62
62
type Annotation () =
63
63
inherit DynamicObj ()
64
64
65
65
/// Init Annotation type
66
- static member init ( applyStyle : Annotation -> Annotation ) =
67
- Annotation() |> applyStyle
66
+ static member init
67
+ (
68
+ X : float ,
69
+ Y : float ,
70
+ ? XRef ,
71
+ ? YRef ,
72
+ ? ArrowTailX : float ,
73
+ ? ArrowTailY : float ,
74
+ ? ShowArrow : bool ,
75
+ ? ArrowColor ,
76
+ ? ArrowHead : StyleParam.ArrowHead ,
77
+ ? ArrowSize : float ,
78
+ ? ArrowWidth : float ,
79
+ ? Z : float ,
80
+ ? Text : string ,
81
+ ? TextAngle : float ,
82
+ ? Font : Font ,
83
+ ? Width : float ,
84
+ ? Height : float ,
85
+ ? Opacity : float ,
86
+ ? HorizontalAlign : StyleParam.HorizontalAlign ,
87
+ ? VerticalAlign : StyleParam.VerticalAlign ,
88
+ ? BGColor ,
89
+ ? BorderColor ,
90
+ ? Visible : bool
91
+ ) =
92
+ Annotation()
93
+ |> Annotation.style
94
+ (
95
+ X = X ,
96
+ Y = Y ,
97
+ ?XRef = XRef ,
98
+ ?YRef = YRef ,
99
+ ?ArrowTailX = ArrowTailX ,
100
+ ?ArrowTailY = ArrowTailY ,
101
+ ?ShowArrow = ShowArrow ,
102
+ ?ArrowColor = ArrowColor ,
103
+ ?ArrowHead = ArrowHead ,
104
+ ?ArrowSize = ArrowSize ,
105
+ ?ArrowWidth = ArrowWidth ,
106
+ ?Z = Z ,
107
+ ?Text = Text ,
108
+ ?TextAngle = TextAngle ,
109
+ ?Font = Font ,
110
+ ?Width = Width ,
111
+ ?Height = Height ,
112
+ ?Opacity = Opacity ,
113
+ ?HorizontalAlign = HorizontalAlign ,
114
+ ?VerticalAlign = VerticalAlign ,
115
+ ?BGColor = BGColor ,
116
+ ?BorderColor = BorderColor ,
117
+ ?Visible = Visible
118
+ )
68
119
120
+ static member style
121
+ (
122
+ X : float ,
123
+ Y : float ,
124
+ ? XRef ,
125
+ ? YRef ,
126
+ ? ArrowTailX : float ,
127
+ ? ArrowTailY : float ,
128
+ ? ShowArrow : bool ,
129
+ ? ArrowColor ,
130
+ ? ArrowHead : StyleParam.ArrowHead ,
131
+ ? ArrowSize : float ,
132
+ ? ArrowWidth : float ,
133
+ ? Z : float ,
134
+ ? Text : string ,
135
+ ? TextAngle : float ,
136
+ ? Font : Font ,
137
+ ? Width : float ,
138
+ ? Height : float ,
139
+ ? Opacity : float ,
140
+ ? HorizontalAlign : StyleParam.HorizontalAlign ,
141
+ ? VerticalAlign : StyleParam.VerticalAlign ,
142
+ ? BGColor ,
143
+ ? BorderColor ,
144
+ ? Visible : bool
145
+
146
+ ) =
147
+ ( fun ( ann : Annotation ) ->
148
+ X |> DynObj.setValue ann " x"
149
+ Y |> DynObj.setValue ann " y"
150
+ XRef |> DynObj.setValueOpt ann " xref"
151
+ YRef |> DynObj.setValueOpt ann " yref"
152
+ ArrowTailX |> DynObj.setValueOpt ann " ax"
153
+ ArrowTailY |> DynObj.setValueOpt ann " ay"
154
+ ArrowHead |> DynObj.setValueOptBy ann " arrowhead" StyleParam.ArrowHead.convert
155
+ ArrowSize |> DynObj.setValueOpt ann " arrowsize"
156
+ ArrowWidth |> DynObj.setValueOpt ann " arrowwidth"
157
+ ShowArrow |> DynObj.setValueOpt ann " showarrow"
158
+ ArrowColor |> DynObj.setValueOpt ann " arrowcolor"
159
+ Z |> DynObj.setValueOpt ann " z"
160
+ Text |> DynObj.setValueOpt ann " text"
161
+ TextAngle |> DynObj.setValueOpt ann " textangle"
162
+ Font |> DynObj.setValueOpt ann " font"
163
+ Width |> DynObj.setValueOpt ann " width"
164
+ Height |> DynObj.setValueOpt ann " height"
165
+ Opacity |> DynObj.setValueOpt ann " opacity"
166
+ HorizontalAlign |> DynObj.setValueOptBy ann " align" StyleParam.HorizontalAlign.convert
167
+ VerticalAlign |> DynObj.setValueOptBy ann " valign" StyleParam.VerticalAlign.convert
168
+ BGColor |> DynObj.setValueOpt ann " bgcolor"
169
+ BorderColor |> DynObj.setValueOpt ann " bordercolor"
170
+ Visible |> DynObj.setValueOpt ann " visible"
171
+
172
+ ann
173
+ )
69
174
70
175
/// Layout
71
176
type Layout () =
@@ -84,7 +189,7 @@ type Layout() =
84
189
//?xAxis : Axis.LinearAxis,
85
190
//?yAxis : Axis.LinearAxis,
86
191
? Legend ,
87
- ? Annotations : Annotation ,
192
+ ? Annotations : seq < Annotation > ,
88
193
? Margin ,
89
194
90
195
? Paper_bgcolor ,
0 commit comments