Skip to content

Commit f51c611

Browse files
committed
plotlyjs v2.8.0: add horizontal color bar options (plotly/plotly.js#6024)
1 parent b76bf18 commit f51c611

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/Plotly.NET/ChartAPI/GenericChart.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module HTML =
1515
<head>
1616
<!-- Plotly.js -->
1717
<meta http-equiv="X-UA-Compatible" content="IE=11" >
18-
<script src="https://cdn.plot.ly/plotly-2.7.0.min.js"></script>
18+
<script src="https://cdn.plot.ly/plotly-2.8.3.min.js"></script>
1919
[ADDITIONAL_HEAD_TAGS]
2020
<style>
2121
.container {
@@ -58,7 +58,7 @@ module HTML =
5858
newScript.AppendLine(
5959
@"
6060
var renderPlotly_[SCRIPTID] = function() {
61-
var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-2.7.0.min'}}) || require;
61+
var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-2.8.3.min'}}) || require;
6262
fsharpPlotlyRequire(['plotly'], function(Plotly) {"
6363
)
6464
|> ignore

src/Plotly.NET/CommonAbstractions/ColorBar.fs

+9-5
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ type ColorBar() =
6464
[<Optional; DefaultParameterValue(null)>] ?LenMode: StyleParam.UnitMode,
6565
[<Optional; DefaultParameterValue(null)>] ?MinExponent: float,
6666
[<Optional; DefaultParameterValue(null)>] ?NTicks: int,
67+
[<Optional; DefaultParameterValue(null)>] ?Orientation: StyleParam.Orientation,
6768
[<Optional; DefaultParameterValue(null)>] ?OutlineColor: Color,
6869
[<Optional; DefaultParameterValue(null)>] ?OutlineWidth: float,
6970
[<Optional; DefaultParameterValue(null)>] ?SeparateThousands: bool,
@@ -108,6 +109,7 @@ type ColorBar() =
108109
?LenMode = LenMode,
109110
?MinExponent = MinExponent,
110111
?NTicks = NTicks,
112+
?Orientation = Orientation,
111113
?OutlineColor = OutlineColor,
112114
?OutlineWidth = OutlineWidth,
113115
?SeparateThousands = SeparateThousands,
@@ -171,7 +173,7 @@ type ColorBar() =
171173
/// <param name="TickFormat">Sets the tick label 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. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: "%h" for half of the year as a decimal number as well as "%{n}f" for fractional seconds with n digits. For example, "2016-10-13 09:15:23.456" with tickformat "%H~%M~%S.%2f" would display "09~15~23.46"</param>
172174
/// <param name="TickFormatStops">Set rules for customizing TickFormat on different zoom levels</param>
173175
/// <param name="TickLabelOverflow">Determines how we handle tick labels that would overflow either the graph div or the domain of the axis. The default value for inside tick labels is "hide past domain". In other cases the default is "hide past div".</param>
174-
/// <param name="TickLabelPosition">Determines where tick labels are drawn.</param>
176+
/// <param name="TickLabelPosition">Determines where tick labels are drawn relative to the ticks. Left and right options are used when `orientation` is *h*, top and bottom when `orientation` is *v*.</param>
175177
/// <param name="TickLen">Sets the tick length (in px).</param>
176178
/// <param name="TickMode">Sets the tick mode for this axis. If "auto", the number of ticks is set via `nticks`. If "linear", the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` ("linear" is the default value if `tick0` and `dtick` are provided). If "array", the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. ("array" is the default value if `tickvals` is provided).</param>
177179
/// <param name="TickPrefix">Sets a tick label prefix.</param>
@@ -181,11 +183,11 @@ type ColorBar() =
181183
/// <param name="TickVals">Sets the values at which ticks on this axis appear. Only has an effect if `tickmode` is set to "array". Used with `ticktext`.</param>
182184
/// <param name="TickWidth">Sets the tick width (in px).</param>
183185
/// <param name="Title">Sets the ColorBar title.</param>
184-
/// <param name="X">Sets the x position of the color bar (in plot fraction).</param>
185-
/// <param name="XAnchor">Sets this color bar's horizontal position anchor. This anchor binds the `x` position to the "left", "center" or "right" of the color bar.</param>
186+
/// <param name="X">Sets the x position of the color bar (in plot fraction). Defaults to 1.02 when `orientation` is *v* and 0.5 when `orientation` is *h*.</param>
187+
/// <param name="XAnchor">'Sets this color bar's horizontal position anchor. This anchor binds the `x` position to the *left*, *center*, or *right* of the color bar. Defaults to *left* when `orientation` is *v* and *center* when `orientation` is *h*.</param>
186188
/// <param name="XPad">Sets the amount of padding (in px) along the x direction.</param>
187-
/// <param name="Y">Sets the y position of the color bar (in plot fraction).</param>
188-
/// <param name="YAnchor">Sets this color bar's vertical position anchor This anchor binds the `y` position to the "top", "middle" or "bottom" of the color bar.</param>
189+
/// <param name="Y">Sets the y position of the color bar (in plot fraction).Defaults to 0.5 when `orientation` is *v* and 1.02 when `orientation` is *h*.'</param>
190+
/// <param name="YAnchor">'Sets this color bar\'s vertical position anchor. This anchor binds the `y` position to the *top*, *middle* or *bottom* of the color bar.Defaults to *middle* when `orientation` is *v* and *bottom* when `orientation` is *h*.'</param>
189191
/// <param name="YPad">Sets the amount of padding (in px) along the y direction.</param>
190192
static member style
191193
(
@@ -198,6 +200,7 @@ type ColorBar() =
198200
[<Optional; DefaultParameterValue(null)>] ?LenMode: StyleParam.UnitMode,
199201
[<Optional; DefaultParameterValue(null)>] ?MinExponent: float,
200202
[<Optional; DefaultParameterValue(null)>] ?NTicks: int,
203+
[<Optional; DefaultParameterValue(null)>] ?Orientation: StyleParam.Orientation,
201204
[<Optional; DefaultParameterValue(null)>] ?OutlineColor: Color,
202205
[<Optional; DefaultParameterValue(null)>] ?OutlineWidth: float,
203206
[<Optional; DefaultParameterValue(null)>] ?SeparateThousands: bool,
@@ -243,6 +246,7 @@ type ColorBar() =
243246
LenMode |> DynObj.setValueOptBy colorBar "lenmode" StyleParam.UnitMode.convert
244247
MinExponent |> DynObj.setValueOpt colorBar "min3xponent"
245248
NTicks |> DynObj.setValueOpt colorBar "nticks"
249+
Orientation |> DynObj.setValueOptBy colorBar "orientation" StyleParam.Orientation.convert
246250
OutlineColor |> DynObj.setValueOpt colorBar "outlinecolor"
247251
OutlineWidth |> DynObj.setValueOpt colorBar "outlinewidth"
248252
SeparateThousands |> DynObj.setValueOpt colorBar "separatethousands"

tests/Plotly.NET.Tests/HtmlCodegen/SimpleTests.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ let simpleChart =
2020
let ``Html layout tests`` =
2121
testList "SimpleTests.Simple tests" [
2222
testCase "Expecting plotly js" ( fun () ->
23-
"https://cdn.plot.ly/plotly-2.7.0.min"
23+
"https://cdn.plot.ly/plotly-2.8.3.min"
2424
|> chartGeneratedContains simpleChart
2525
);
2626
testCase "Expecting data" ( fun () ->
@@ -36,7 +36,7 @@ let ``Html layout tests`` =
3636
|> chartGeneratedContains simpleChart
3737
);
3838
testCase "Expecting require config" (fun () ->
39-
"var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-2.7.0.min'}}) || require;"
39+
"var fsharpPlotlyRequire = requirejs.config({context:'fsharp-plotly',paths:{plotly:'https://cdn.plot.ly/plotly-2.8.3.min'}}) || require;"
4040
|> chartGeneratedContains simpleChart
4141
);
4242
testCase "Expecting html tags in embedded page only" (fun () ->

0 commit comments

Comments
 (0)