-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathIndicator.fs
More file actions
275 lines (242 loc) · 9.44 KB
/
Indicator.fs
File metadata and controls
275 lines (242 loc) · 9.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
namespace Plotly.NET.TraceObjects
open Plotly.NET
open Plotly.NET.LayoutObjects
open DynamicObj
open System
open System.Runtime.InteropServices
type IndicatorSymbol() =
inherit DynamicObj()
static member init
(
?Color: Color,
?Symbol: string
) =
IndicatorSymbol() |> IndicatorSymbol.style (?Color = Color, ?Symbol = Symbol)
static member style
(
?Color: Color,
?Symbol: string
) =
fun (indicatorDirection: IndicatorSymbol) ->
indicatorDirection
|> DynObj.withOptionalProperty "color" Color
|> DynObj.withOptionalProperty "symbol" Symbol
type IndicatorDelta() =
inherit DynamicObj()
/// <summary>
/// Returns a new IndicatorDelta object with the given styles
/// </summary>
/// <param name="Decreasing">Sets the style of decreasing deltas.</param>
/// <param name="Font">Set the font used to display the delta</param>
/// <param name="Increasing">Sets the style of increasing deltas.</param>
/// <param name="Position">Sets the position of delta with respect to the number.</param>
/// <param name="Prefix">Sets a prefix appearing before the delta.</param>
/// <param name="Reference">Sets the reference value to compute the delta. By default, it is set to the current value.</param>
/// <param name="Relative">Show relative change</param>
/// <param name="Suffix">Sets a suffix appearing next to the delta.</param>
/// <param name="ValueFormat">Sets the value formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format.</param>
static member init
(
?Decreasing: IndicatorSymbol,
?Font: Font,
?Increasing: IndicatorSymbol,
?Position: StyleParam.IndicatorDeltaPosition,
?Prefix: string,
?Reference: #IConvertible,
?Relative: bool,
?Suffix: string,
?ValueFormat: string
) =
IndicatorDelta()
|> IndicatorDelta.style (
?Decreasing = Decreasing,
?Font = Font,
?Increasing = Increasing,
?Position = Position,
?Prefix = Prefix,
?Reference = Reference,
?Relative = Relative,
?Suffix = Suffix,
?ValueFormat = ValueFormat
)
/// <summary>
/// Returns a function that applies the given styles to an IndicatorDelta object
/// </summary>
/// <param name="Decreasing">Sets the style of decreasing deltas.</param>
/// <param name="Font">Set the font used to display the delta</param>
/// <param name="Increasing">Sets the style of increasing deltas.</param>
/// <param name="Position">Sets the position of delta with respect to the number.</param>
/// <param name="Prefix">Sets a prefix appearing before the delta.</param>
/// <param name="Reference">Sets the reference value to compute the delta. By default, it is set to the current value.</param>
/// <param name="Relative">Show relative change</param>
/// <param name="Suffix">Sets a suffix appearing next to the delta.</param>
/// <param name="ValueFormat">Sets the value formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format.</param>
static member style
(
?Decreasing: IndicatorSymbol,
?Font: Font,
?Increasing: IndicatorSymbol,
?Position: StyleParam.IndicatorDeltaPosition,
?Prefix: string,
?Reference: #IConvertible,
?Relative: bool,
?Suffix: string,
?ValueFormat: string
) =
fun (indicatorDelta: IndicatorDelta) ->
indicatorDelta
|> DynObj.withOptionalProperty "decreasing" Decreasing
|> DynObj.withOptionalProperty "font" Font
|> DynObj.withOptionalProperty "increasing" Increasing
|> DynObj.withOptionalPropertyBy "position" Position StyleParam.IndicatorDeltaPosition.convert
|> DynObj.withOptionalProperty "prefix" Prefix
|> DynObj.withOptionalProperty "reference" Reference
|> DynObj.withOptionalProperty "relative" Relative
|> DynObj.withOptionalProperty "suffix" Suffix
|> DynObj.withOptionalProperty "valueformat" ValueFormat
type IndicatorNumber() =
inherit DynamicObj()
static member init
(
?Font: Font,
?Prefix: string,
?Suffix: string,
?ValueFormat: string
) =
IndicatorNumber()
|> IndicatorNumber.style (?Font = Font, ?Prefix = Prefix, ?Suffix = Suffix, ?ValueFormat = ValueFormat)
static member style
(
?Font: Font,
?Prefix: string,
?Suffix: string,
?ValueFormat: string
) =
fun (indicatorNumber: IndicatorNumber) ->
indicatorNumber
|> DynObj.withOptionalProperty "font" Font
|> DynObj.withOptionalProperty "prefix" Prefix
|> DynObj.withOptionalProperty "suffix" Suffix
|> DynObj.withOptionalProperty "valueformat" ValueFormat
type IndicatorBar() =
inherit DynamicObj()
static member init
(
?Color: Color,
?Line: Line,
?Thickness: float
) =
IndicatorBar() |> IndicatorBar.style (?Color = Color, ?Line = Line, ?Thickness = Thickness)
static member style
(
?Color: Color,
?Line: Line,
?Thickness: float
) =
fun (indicatorBar: IndicatorBar) ->
indicatorBar
|> DynObj.withOptionalProperty "color" Color
|> DynObj.withOptionalProperty "line" Line
|> DynObj.withOptionalProperty "thickness" Thickness
type IndicatorStep() =
inherit DynamicObj()
static member init
(
?Color: Color,
?Line: Line,
?Name: string,
?Range: StyleParam.Range,
?TemplateItemName: string,
?Thickness: float
) =
IndicatorStep()
|> IndicatorStep.style (
?Color = Color,
?Line = Line,
?Name = Name,
?Range = Range,
?TemplateItemName = TemplateItemName,
?Thickness = Thickness
)
static member style
(
?Color: Color,
?Line: Line,
?Name: string,
?Range: StyleParam.Range,
?TemplateItemName: string,
?Thickness: float
) =
fun (indicatorSteps: IndicatorStep) ->
indicatorSteps
|> DynObj.withOptionalProperty "color" Color
|> DynObj.withOptionalProperty "line" Line
|> DynObj.withOptionalProperty "name" Name
|> DynObj.withOptionalPropertyBy "range" Range StyleParam.Range.convert
|> DynObj.withOptionalProperty "templateitemname" TemplateItemName
|> DynObj.withOptionalProperty "thickness" Thickness
type IndicatorThreshold() =
inherit DynamicObj()
static member init
(
?Line: Line,
?Thickness: float,
?Value: #IConvertible
) =
IndicatorThreshold() |> IndicatorThreshold.style (?Line = Line, ?Thickness = Thickness, ?Value = Value)
static member style
(
?Line: Line,
?Thickness: float,
?Value: #IConvertible
) =
fun (indicatorThreshold: IndicatorThreshold) ->
indicatorThreshold
|> DynObj.withOptionalProperty "line" Line
|> DynObj.withOptionalProperty "thickness" Thickness
|> DynObj.withOptionalProperty "value" Value
type IndicatorGauge() =
inherit DynamicObj()
static member init
(
?Axis: LinearAxis,
?Bar: IndicatorBar,
?BGColor: Color,
?BorderColor: Color,
?BorderWidth: int,
?Shape: StyleParam.IndicatorGaugeShape,
?Steps: seq<IndicatorStep>,
?Threshold: IndicatorThreshold
) =
IndicatorGauge()
|> IndicatorGauge.style (
?Axis = Axis,
?Bar = Bar,
?BGColor = BGColor,
?BorderColor = BorderColor,
?BorderWidth = BorderWidth,
?Shape = Shape,
?Steps = Steps,
?Threshold = Threshold
)
static member style
(
?Axis: LinearAxis,
?Bar: IndicatorBar,
?BGColor: Color,
?BorderColor: Color,
?BorderWidth: int,
?Shape: StyleParam.IndicatorGaugeShape,
?Steps: seq<IndicatorStep>,
?Threshold: IndicatorThreshold
) =
fun (indicatorGauge: IndicatorGauge) ->
indicatorGauge
|> DynObj.withOptionalProperty "axis" Axis
|> DynObj.withOptionalProperty "bar" Bar
|> DynObj.withOptionalProperty "bgcolor" BGColor
|> DynObj.withOptionalProperty "bordercolor" BorderColor
|> DynObj.withOptionalProperty "borderwidth" BorderWidth
|> DynObj.withOptionalPropertyBy "shape" Shape StyleParam.IndicatorGaugeShape.convert
|> DynObj.withOptionalProperty "steps" Steps
|> DynObj.withOptionalProperty "threshold" Threshold