@@ -28,9 +28,12 @@ type Chart =
28
28
29
29
/// Uses points to represent data points
30
30
static member Point ( x , y ,? Name ,? Showlegend ,? MarkerSymbol ,? Color ,? Opacity ,? Labels ,? TextPosition ,? TextFont ) =
31
+ // if text position or font is set than show labels (not only when hovering)
32
+ let changeMode = StyleOption.ModeUtils.showText ( TextPosition.IsSome || TextFont.IsSome)
33
+
31
34
let trace =
32
35
TraceObjects.Scatter()
33
- |> Options.Scatter( X = x, Y = y, Mode = StyleOption.Markers)
36
+ |> Options.Scatter( X = x, Y = y, Mode = changeMode StyleOption.Markers)
34
37
|> Options.ITraceInfo( ?Name= Name,? Showlegend= Showlegend,? Opacity= Opacity)
35
38
|> Options.IMarker( Options.Marker( ?Color= Color,? Symbol= MarkerSymbol))
36
39
|> Options.ITextLabel( ?Text= Labels,? Textposition= TextPosition,? Textfont= TextFont)
@@ -44,13 +47,19 @@ type Chart =
44
47
45
48
/// Uses lines to represent data points
46
49
static member Line ( x , y ,? Name ,? ShowMarkers ,? Showlegend ,? MarkerSymbol ,? Color ,? Opacity ,? Labels ,? TextPosition ,? TextFont ,? Dash ,? Width ) =
47
- let mode ' =
48
- match ShowMarkers with
49
- | Some show -> if show then StyleOption.Lines_ Markers else StyleOption.Lines
50
- | None -> StyleOption.Lines_ Markers // default
50
+ // if text position or font is set than show labels (not only when hovering)
51
+ let changeMode =
52
+ let isShowMarker =
53
+ match ShowMarkers with
54
+ | Some isShow -> isShow
55
+ | None -> false
56
+ StyleOption.ModeUtils.showText ( TextPosition.IsSome || TextFont.IsSome)
57
+ >> StyleOption.ModeUtils.showMarker ( isShowMarker)
58
+
59
+
51
60
let trace =
52
61
TraceObjects.Scatter()
53
- |> Options.Scatter( X = x, Y = y, Mode = mode' )
62
+ |> Options.Scatter( X = x, Y = y, Mode = ( changeMode StyleOption.Mode.Lines ))
54
63
|> Options.ITraceInfo( ?Name= Name,? Showlegend= Showlegend,? Opacity= Opacity)
55
64
|> Options.ILine( Options.Line( ?Color= Color,? Dash= Dash,? Width= Width))
56
65
|> Options.IMarker( Options.Marker( ?Color= Color,? Symbol= MarkerSymbol))
@@ -65,13 +74,16 @@ type Chart =
65
74
66
75
/// A Line chart that plots a fitted curve through each data point in a series.
67
76
static member Spline ( x , y ,? Name ,? ShowMarkers ,? Showlegend ,? MarkerSymbol ,? Color ,? Opacity ,? Labels ,? TextPosition ,? TextFont ,? Dash ,? Width ,? Smoothing ) =
68
- let mode ' =
69
- match ShowMarkers with
70
- | Some show -> if show then StyleOption.Lines_ Markers else StyleOption.Lines
71
- | None -> StyleOption.Lines_ Markers // default
77
+ let changeMode =
78
+ let isShowMarker =
79
+ match ShowMarkers with
80
+ | Some isShow -> isShow
81
+ | None -> false
82
+ StyleOption.ModeUtils.showText ( TextPosition.IsSome || TextFont.IsSome)
83
+ >> StyleOption.ModeUtils.showMarker ( isShowMarker)
72
84
let trace =
73
85
TraceObjects.Scatter()
74
- |> Options.Scatter( X = x, Y = y, Mode = mode' , ?Fillcolor= Color)
86
+ |> Options.Scatter( X = x, Y = y, Mode = ( changeMode StyleOption.Mode.Lines ) , ?Fillcolor= Color)
75
87
|> Options.ITraceInfo( ?Name= Name,? Showlegend= Showlegend,? Opacity= Opacity)
76
88
|> Options.ILine( Options.Line( ?Color= Color,? Dash= Dash,? Width= Width, Shape= StyleOption.Shape.Spline, ?Smoothing= Smoothing))
77
89
|> Options.IMarker( Options.Marker( ?Color= Color,? Symbol= MarkerSymbol))
@@ -86,9 +98,12 @@ type Chart =
86
98
87
99
/// A variation of the Point chart type, where the data points are replaced by bubbles of different sizes.
88
100
static member Bubble ( x , y , sizes : seq < #IConvertible >,? Name ,? Showlegend ,? MarkerSymbol ,? Color ,? Opacity ,? Labels ,? TextPosition ,? TextFont ) =
101
+ // if text position or font is set than show labels (not only when hovering)
102
+ let changeMode = StyleOption.ModeUtils.showText ( TextPosition.IsSome || TextFont.IsSome)
103
+
89
104
let trace =
90
105
TraceObjects.Scatter()
91
- |> Options.Scatter( X = x, Y = y, Mode = StyleOption.Markers)
106
+ |> Options.Scatter( X = x, Y = y, Mode = changeMode StyleOption.Markers)
92
107
|> Options.ITraceInfo( ?Name= Name,? Showlegend= Showlegend,? Opacity= Opacity)
93
108
|> Options.IMarker( Options.Marker( ?Color= Color,? Symbol= MarkerSymbol, MultiSizes= sizes))
94
109
|> Options.ITextLabel( ?Text= Labels,? Textposition= TextPosition,? Textfont= TextFont)
@@ -102,12 +117,18 @@ type Chart =
102
117
103
118
/// Displays a range of data by plotting two Y values per data point, with each Y value being drawn as a line
104
119
static member Range ( x , y , upper , lower ,? Name ,? ShowMarkers ,? Showlegend ,? Color ,? RangeColor ,? Labels ,? TextPosition ,? TextFont ) =
105
- let mode ' = match ShowMarkers with
106
- | Some show -> if show then StyleOption.Lines_ Markers else StyleOption.Lines
107
- | None -> StyleOption.Lines_ Markers // default
120
+ // if text position or font is set than show labels (not only when hovering)
121
+ let changeMode =
122
+ let isShowMarker =
123
+ match ShowMarkers with
124
+ | Some isShow -> isShow
125
+ | None -> false
126
+ StyleOption.ModeUtils.showText ( TextPosition.IsSome || TextFont.IsSome)
127
+ >> StyleOption.ModeUtils.showMarker ( isShowMarker)
128
+
108
129
let trace =
109
130
TraceObjects.Scatter()
110
- |> Options.Scatter( X = x, Y = y, Mode = mode' , ?Fillcolor= Color)
131
+ |> Options.Scatter( X = x, Y = y, Mode = changeMode StyleOption.Mode.Lines , ?Fillcolor= Color)
111
132
|> Options.ITraceInfo( ?Name= Name,? Showlegend= Showlegend)
112
133
|> Options.ILine( Options.Line( ?Color= Color))
113
134
|> Options.IMarker( Options.Marker( ?Color= Color))
@@ -134,13 +155,18 @@ type Chart =
134
155
135
156
/// Emphasizes the degree of change over time and shows the relationship of the parts to a whole.
136
157
static member Area ( x , y ,? Name ,? ShowMarkers ,? Showlegend ,? MarkerSymbol ,? Color ,? Opacity ,? Labels ,? TextPosition ,? TextFont ,? Dash ,? Width ) =
137
- let mode ' =
138
- match ShowMarkers with
139
- | Some show -> if show then StyleOption.Lines_ Markers else StyleOption.Lines
140
- | None -> StyleOption.Lines // default
158
+ // if text position or font is set than show labels (not only when hovering)
159
+ let changeMode =
160
+ let isShowMarker =
161
+ match ShowMarkers with
162
+ | Some isShow -> isShow
163
+ | None -> false
164
+ StyleOption.ModeUtils.showText ( TextPosition.IsSome || TextFont.IsSome)
165
+ >> StyleOption.ModeUtils.showMarker ( isShowMarker)
166
+
141
167
let trace =
142
168
TraceObjects.Scatter()
143
- |> Options.Scatter( X = x, Y = y, Mode = mode' , Fill= StyleOption.ToZero_ y)
169
+ |> Options.Scatter( X = x, Y = y, Mode = changeMode StyleOption.Mode.Lines , Fill= StyleOption.ToZero_ y)
144
170
|> Options.ITraceInfo( ?Name= Name,? Showlegend= Showlegend,? Opacity= Opacity)
145
171
|> Options.ILine( Options.Line( ?Color= Color,? Dash= Dash,? Width= Width))
146
172
|> Options.IMarker( Options.Marker( ?Color= Color,? Symbol= MarkerSymbol))
@@ -155,13 +181,17 @@ type Chart =
155
181
156
182
/// Emphasizes the degree of change over time and shows the relationship of the parts to a whole.
157
183
static member SplineArea ( x , y ,? Name ,? ShowMarkers ,? Showlegend ,? MarkerSymbol ,? Color ,? Opacity ,? Labels ,? TextPosition ,? TextFont ,? Dash ,? Width ,? Smoothing ) =
158
- let mode ' =
159
- match ShowMarkers with
160
- | Some show -> if show then StyleOption.Lines_ Markers else StyleOption.Lines
161
- | None -> StyleOption.Lines // default
184
+ // if text position or font is set than show labels (not only when hovering)
185
+ let changeMode =
186
+ let isShowMarker =
187
+ match ShowMarkers with
188
+ | Some isShow -> isShow
189
+ | None -> false
190
+ StyleOption.ModeUtils.showText ( TextPosition.IsSome || TextFont.IsSome)
191
+ >> StyleOption.ModeUtils.showMarker ( isShowMarker)
162
192
let trace =
163
193
TraceObjects.Scatter()
164
- |> Options.Scatter( X = x, Y = y, Mode = mode' , Fill= StyleOption.ToZero_ y)
194
+ |> Options.Scatter( X = x, Y = y, Mode = changeMode StyleOption.Mode.Lines , Fill= StyleOption.ToZero_ y)
165
195
|> Options.ITraceInfo( ?Name= Name,? Showlegend= Showlegend,? Opacity= Opacity)
166
196
|> Options.ILine( Options.Line( Shape= StyleOption.Shape.Spline,? Color= Color,? Dash= Dash,? Width= Width,? Smoothing= Smoothing))
167
197
|> Options.IMarker( Options.Marker( ?Color= Color,? Symbol= MarkerSymbol))
0 commit comments