Skip to content

Commit 047f95d

Browse files
committed
Add obsolete tags fore Range Charts to ensure backwards compatibility
1 parent 1894f87 commit 047f95d

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/FSharp.Plotly/Chart.fs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,51 @@ type Chart =
134134
static member Bubble(xysizes,?Name,?Showlegend,?MarkerSymbol,?Color,?Opacity,?Labels,?TextPosition,?TextFont) =
135135
let x,y,sizes = Seq.unzip3 xysizes
136136
Chart.Bubble(x, y,sizes=sizes,?Name=Name,?Showlegend=Showlegend,?MarkerSymbol=MarkerSymbol,?Color=Color,?Opacity=Opacity,?Labels=Labels,?TextPosition=TextPosition,?TextFont=TextFont)
137+
138+
139+
/// Displays a range of data by plotting two Y values per data point, with each Y value being drawn as a line
140+
[<Obsolete("Use the constructors with the mandatory mode argument for full functionality")>]
141+
static member Range(x, y, upper, lower,?Name,?ShowMarkers,?Showlegend,?Color,?RangeColor,?Labels,?TextPosition,?TextFont) =
142+
// if text position or font is set than show labels (not only when hovering)
143+
let changeMode =
144+
let isShowMarker =
145+
match ShowMarkers with
146+
| Some isShow -> isShow
147+
| Option.None -> false
148+
StyleParam.ModeUtils.showText (TextPosition.IsSome || TextFont.IsSome)
149+
>> StyleParam.ModeUtils.showMarker (isShowMarker)
150+
151+
152+
let trace =
153+
Trace.initScatter (
154+
TraceStyle.Scatter(X = x,Y = y, Mode=changeMode StyleParam.Markers, ?Fillcolor=Color) )
155+
|> TraceStyle.TraceInfo(?Name=Name,?Showlegend=Showlegend)
156+
|> TraceStyle.Line(?Color=Color)
157+
|> TraceStyle.Marker(?Color=Color)
158+
|> TraceStyle.TextLabel(?Text=Labels,?Textposition=TextPosition,?Textfont=TextFont)
159+
160+
let lower =
161+
Trace.initScatter (
162+
TraceStyle.Scatter(X = x,Y = lower, Mode=StyleParam.Lines, ?Fillcolor=RangeColor) )
163+
|> TraceStyle.TraceInfo(Showlegend=false)
164+
|> TraceStyle.Line(Width=0)
165+
|> TraceStyle.Marker(Color=if RangeColor.IsSome then RangeColor.Value else "rgba(0,0,,0.5)")
166+
167+
let upper =
168+
Trace.initScatter (
169+
TraceStyle.Scatter(X = x,Y = upper, Mode=StyleParam.Lines, ?Fillcolor=RangeColor, Fill=StyleParam.ToNext_y) )
170+
|> TraceStyle.TraceInfo(Showlegend=false)
171+
|> TraceStyle.Line(Width=0)
172+
|> TraceStyle.Marker(Color=if RangeColor.IsSome then RangeColor.Value else "rgba(0,0,,0.5)")
173+
174+
GenericChart.MultiChart ([lower;upper;trace],Layout(),Config())
175+
176+
[<Obsolete("Use the constructors with the mandatory mode argument for full functionality")>]
177+
/// Displays a range of data by plotting two Y values per data point, with each Y value being drawn as a line
178+
static member Range(xy, upper, lower,?Name,?ShowMarkers,?Showlegend,?Color,?RangeColor,?Labels,?TextPosition,?TextFont) =
179+
let x,y = Seq.unzip xy
180+
Chart.Range(x, y, upper, lower, ?Name=Name,?ShowMarkers=ShowMarkers,?Showlegend=Showlegend,?Color=Color,?RangeColor=RangeColor,?Labels=Labels,?TextPosition=TextPosition,?TextFont=TextFont)
181+
137182

138183

139184
/// Displays a range of data by plotting two Y values per data point, with each Y value being drawn as a line

0 commit comments

Comments
 (0)