Skip to content

Commit 0277288

Browse files
committedJun 28, 2024
add temporary fix for multi legend regression bug in docs
1 parent f78f599 commit 0277288

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed
 

‎docs/chart-layout/legends.fsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,17 @@ grouped_legend_chart |> GenericChart.toChartHTML
141141
142142
Starting with Plotly.NET 5.0.0, the multiple legends feature from plotl.js v2.22+ is supported.
143143
144+
However, plotly.js has a [regression bug starting from 2.24.3](https://github.com/plotly/plotly.js/issues/7023), which causes multiple legends to not display correctly
145+
146+
This means that the referenced plotly.js version has to be changed to <2.24.3 to use this feature. Note that features introduced in plotly.js/.NET after this version will not work on a chart using that reference.
147+
Future versions of plotly.js will hopefully fix this issue.
148+
144149
Similarily to how multiple axes are handled, multiple legends are added by providing an additional `Id` argument when using the `Chart.withLegend` function:
145150
146151
To select which legend a trace should belong to, use `Chart.withLegendAnchor` with the corresponding `id` argument.
147152
*)
148153

154+
149155
let multi_legend_chart =
150156
[
151157
Chart.Point(x, y)
@@ -175,12 +181,16 @@ let multi_legend_chart =
175181
),
176182
Id = 2
177183
)
184+
// set lower plotly.js version to avoid regression bug
185+
|> Chart.withDisplayOptionsStyle(
186+
PlotlyJSReference = Plotly.NET.PlotlyJSReference.CDN "https://cdn.plot.ly/plotly-2.23.0.min.js"
187+
)
178188

179189
(*** condition: ipynb ***)
180190
#if IPYNB
181191
multi_legend_chart
182192
#endif // IPYNB
183193

184194
(***hide***)
185-
multi_legend_chart |> GenericChart.toChartHTML
195+
multi_legend_chart |> GenericChart.toEmbeddedHTML
186196
(***include-it-raw***)

0 commit comments

Comments
 (0)