Skip to content

Commit 86a810c

Browse files
committed
#329: add ShowXAxisRangeSlider argument for Chart.OHLC and Chart.Candlestick
1 parent 9311a0e commit 86a810c

File tree

3 files changed

+53
-10
lines changed

3 files changed

+53
-10
lines changed

docs/07_0_ohlc.fsx

+11-5
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,21 @@ ohlc2 |> GenericChart.toChartHTML
106106
(**
107107
## Removing the rangeslider
108108
109-
If you want to hide the rangeslider, use `withXAxisRangeSlider` and hide it:
109+
If you want to hide the rangeslider, set the `ShowXAxisRangeSlider` to false:
110110
*)
111111
open Plotly.NET.LayoutObjects
112112

113-
let rangeslider = RangeSlider.init(Visible=false)
114-
115113
let ohlc3 =
116-
ohlc2
117-
|> Chart.withXAxisRangeSlider rangeslider
114+
Chart.OHLC(
115+
``open`` = openData,
116+
high = highData,
117+
low = lowData,
118+
close = closeData,
119+
x = dateData,
120+
IncreasingColor = Color.fromKeyword Cyan,
121+
DecreasingColor = Color.fromKeyword Gray,
122+
ShowXAxisRangeSlider = false
123+
)
118124

119125
(*** condition: ipynb ***)
120126
#if IPYNB

docs/07_1_candlestick.fsx

+12-5
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,22 @@ candles2 |> GenericChart.toChartHTML
106106
(**
107107
## Removing the rangeslider
108108
109-
If you want to hide the rangeslider, use `withXAxisRangeSlider` and hide it:
109+
If you want to hide the rangeslider, set the `ShowXAxisRangeSlider` to false:
110110
*)
111111
open Plotly.NET.LayoutObjects
112112

113-
let rangeslider = RangeSlider.init(Visible=false)
114-
115113
let candles3 =
116-
candles2
117-
|> Chart.withXAxisRangeSlider rangeslider
114+
Chart.Candlestick(
115+
``open`` = openData,
116+
high = highData,
117+
low = lowData,
118+
close = closeData,
119+
x = dateData,
120+
IncreasingColor = Color.fromKeyword Cyan,
121+
DecreasingColor = Color.fromKeyword Gray,
122+
ShowXAxisRangeSlider = false
123+
)
124+
118125

119126
(*** condition: ipynb ***)
120127
#if IPYNB

src/Plotly.NET/ChartAPI/Chart2D.fs

+30
Original file line numberDiff line numberDiff line change
@@ -5155,6 +5155,7 @@ module Chart2D =
51555155
/// <param name="DecreasingColor">Sets the color of decreasing values</param>
51565156
/// <param name="Decreasing">Sets the style options of decreasing values (use this for more finegrained control than the other increasing-associated arguments).</param>
51575157
/// <param name="TickWidth">Sets the width of the open/close tick marks relative to the "x" minimal interval.</param>
5158+
/// <param name="ShowXAxisRangeSlider">Wether or not to show a rangeslider for the xaxis</param>
51585159
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
51595160
[<Extension>]
51605161
static member OHLC
@@ -5176,6 +5177,7 @@ module Chart2D =
51765177
[<Optional; DefaultParameterValue(null)>] ?DecreasingColor: Color,
51775178
[<Optional; DefaultParameterValue(null)>] ?Decreasing: FinanceMarker,
51785179
[<Optional; DefaultParameterValue(null)>] ?TickWidth: float,
5180+
[<Optional; DefaultParameterValue(true)>] ?ShowXAxisRangeSlider : bool,
51795181
[<Optional; DefaultParameterValue(true)>] ?UseDefaults: bool
51805182
) =
51815183

@@ -5212,6 +5214,13 @@ module Chart2D =
52125214
)
52135215
)
52145216
|> GenericChart.ofTraceObject useDefaults
5217+
|> GenericChart.addLayout(
5218+
Layout.init()
5219+
|> Layout.setLinearAxis(
5220+
id = StyleParam.SubPlotId.XAxis 1,
5221+
axis = LinearAxis.init(RangeSlider = RangeSlider.init(?Visible = ShowXAxisRangeSlider))
5222+
)
5223+
)
52155224

52165225
/// <summary>
52175226
/// Creates an OHLC chart.
@@ -5234,6 +5243,7 @@ module Chart2D =
52345243
/// <param name="DecreasingColor">Sets the color of decreasing values</param>
52355244
/// <param name="Decreasing">Sets the style options of decreasing values (use this for more finegrained control than the other increasing-associated arguments).</param>
52365245
/// <param name="TickWidth">Sets the width of the open/close tick marks relative to the "x" minimal interval.</param>
5246+
/// <param name="ShowXAxisRangeSlider">Wether or not to show a rangeslider for the xaxis</param>
52375247
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
52385248
[<Extension>]
52395249
static member OHLC
@@ -5254,6 +5264,7 @@ module Chart2D =
52545264
[<Optional; DefaultParameterValue(null)>] ?DecreasingColor: Color,
52555265
[<Optional; DefaultParameterValue(null)>] ?Decreasing: FinanceMarker,
52565266
[<Optional; DefaultParameterValue(null)>] ?TickWidth: float,
5267+
[<Optional; DefaultParameterValue(true)>] ?ShowXAxisRangeSlider : bool,
52575268
[<Optional; DefaultParameterValue(true)>] ?UseDefaults: bool
52585269
) =
52595270

@@ -5274,6 +5285,7 @@ module Chart2D =
52745285
?DecreasingColor= DecreasingColor,
52755286
?Decreasing = Decreasing,
52765287
?TickWidth = TickWidth,
5288+
?ShowXAxisRangeSlider = ShowXAxisRangeSlider,
52775289
?UseDefaults = UseDefaults
52785290
)
52795291

@@ -5294,6 +5306,7 @@ module Chart2D =
52945306
/// <param name="DecreasingColor">Sets the color of decreasing values</param>
52955307
/// <param name="Decreasing">Sets the style options of decreasing values (use this for more finegrained control than the other increasing-associated arguments).</param>
52965308
/// <param name="TickWidth">Sets the width of the open/close tick marks relative to the "x" minimal interval.</param>
5309+
/// <param name="ShowXAxisRangeSlider">Wether or not to show a rangeslider for the xaxis</param>
52975310
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
52985311
[<Extension>]
52995312
static member OHLC
@@ -5310,6 +5323,7 @@ module Chart2D =
53105323
[<Optional; DefaultParameterValue(null)>] ?DecreasingColor: Color,
53115324
[<Optional; DefaultParameterValue(null)>] ?Decreasing: FinanceMarker,
53125325
[<Optional; DefaultParameterValue(null)>] ?TickWidth: float,
5326+
[<Optional; DefaultParameterValue(true)>] ?ShowXAxisRangeSlider : bool,
53135327
[<Optional; DefaultParameterValue(true)>] ?UseDefaults: bool
53145328
) =
53155329

@@ -5330,6 +5344,7 @@ module Chart2D =
53305344
?DecreasingColor = DecreasingColor,
53315345
?Decreasing = Decreasing,
53325346
?TickWidth = TickWidth,
5347+
?ShowXAxisRangeSlider = ShowXAxisRangeSlider,
53335348
?UseDefaults = UseDefaults
53345349
)
53355350

@@ -5357,6 +5372,7 @@ module Chart2D =
53575372
/// <param name="DecreasingColor">Sets the color of decreasing values</param>
53585373
/// <param name="Decreasing">Sets the style options of decreasing values (use this for more finegrained control than the other increasing-associated arguments).</param>
53595374
/// <param name="WhiskerWidth">Sets the width of the whiskers relative to the box' width. For example, with 1, the whiskers are as wide as the box(es).</param>
5375+
/// <param name="ShowXAxisRangeSlider">Wether or not to show a rangeslider for the xaxis</param>
53605376
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
53615377
static member Candlestick
53625378
(
@@ -5377,6 +5393,7 @@ module Chart2D =
53775393
[<Optional; DefaultParameterValue(null)>] ?DecreasingColor: Color,
53785394
[<Optional; DefaultParameterValue(null)>] ?Decreasing: FinanceMarker,
53795395
[<Optional; DefaultParameterValue(null)>] ?WhiskerWidth: float,
5396+
[<Optional; DefaultParameterValue(true)>] ?ShowXAxisRangeSlider : bool,
53805397
[<Optional; DefaultParameterValue(true)>] ?UseDefaults: bool
53815398
) =
53825399

@@ -5413,6 +5430,13 @@ module Chart2D =
54135430
)
54145431
)
54155432
|> GenericChart.ofTraceObject useDefaults
5433+
|> GenericChart.addLayout(
5434+
Layout.init()
5435+
|> Layout.setLinearAxis(
5436+
id = StyleParam.SubPlotId.XAxis 1,
5437+
axis = LinearAxis.init(RangeSlider = RangeSlider.init(?Visible = ShowXAxisRangeSlider))
5438+
)
5439+
)
54165440

54175441
/// <summary>
54185442
/// Creates a candlestick chart.
@@ -5435,6 +5459,7 @@ module Chart2D =
54355459
/// <param name="DecreasingColor">Sets the color of decreasing values</param>
54365460
/// <param name="Decreasing">Sets the style options of decreasing values (use this for more finegrained control than the other increasing-associated arguments).</param>
54375461
/// <param name="WhiskerWidth">Sets the width of the whiskers relative to the box' width. For example, with 1, the whiskers are as wide as the box(es).</param>
5462+
/// <param name="ShowXAxisRangeSlider">Wether or not to show a rangeslider for the xaxis</param>
54385463
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
54395464
[<Extension>]
54405465
static member Candlestick
@@ -5455,6 +5480,7 @@ module Chart2D =
54555480
[<Optional; DefaultParameterValue(null)>] ?DecreasingColor: Color,
54565481
[<Optional; DefaultParameterValue(null)>] ?Decreasing: FinanceMarker,
54575482
[<Optional; DefaultParameterValue(null)>] ?WhiskerWidth: float,
5483+
[<Optional; DefaultParameterValue(true)>] ?ShowXAxisRangeSlider : bool,
54585484
[<Optional; DefaultParameterValue(true)>] ?UseDefaults: bool
54595485
) =
54605486

@@ -5475,6 +5501,7 @@ module Chart2D =
54755501
?DecreasingColor= DecreasingColor,
54765502
?Decreasing = Decreasing,
54775503
?WhiskerWidth = WhiskerWidth,
5504+
?ShowXAxisRangeSlider = ShowXAxisRangeSlider,
54785505
?UseDefaults = UseDefaults
54795506
)
54805507

@@ -5495,6 +5522,7 @@ module Chart2D =
54955522
/// <param name="DecreasingColor">Sets the color of decreasing values</param>
54965523
/// <param name="Decreasing">Sets the style options of decreasing values (use this for more finegrained control than the other increasing-associated arguments).</param>
54975524
/// <param name="WhiskerWidth">Sets the width of the whiskers relative to the box' width. For example, with 1, the whiskers are as wide as the box(es).</param>
5525+
/// <param name="ShowXAxisRangeSlider">Wether or not to show a rangeslider for the xaxis</param>
54985526
/// <param name="UseDefaults">If set to false, ignore the global default settings set in `Defaults`</param>
54995527
[<Extension>]
55005528
static member Candlestick
@@ -5511,6 +5539,7 @@ module Chart2D =
55115539
[<Optional; DefaultParameterValue(null)>] ?DecreasingColor: Color,
55125540
[<Optional; DefaultParameterValue(null)>] ?Decreasing: FinanceMarker,
55135541
[<Optional; DefaultParameterValue(null)>] ?WhiskerWidth: float,
5542+
[<Optional; DefaultParameterValue(true)>] ?ShowXAxisRangeSlider : bool,
55145543
[<Optional; DefaultParameterValue(true)>] ?UseDefaults: bool
55155544
) =
55165545

@@ -5534,6 +5563,7 @@ module Chart2D =
55345563
?DecreasingColor = DecreasingColor,
55355564
?Decreasing = Decreasing,
55365565
?WhiskerWidth = WhiskerWidth,
5566+
?ShowXAxisRangeSlider = ShowXAxisRangeSlider,
55375567
?UseDefaults = UseDefaults
55385568
)
55395569

0 commit comments

Comments
 (0)