Skip to content

Commit a776f77

Browse files
committed
#406: Add legend attribute to all traces
- this enables setting legend anchors on trace generation - additionally, fix `coloraxis` atribute name on some 3D traces
1 parent f2c1864 commit a776f77

File tree

9 files changed

+134
-4
lines changed

9 files changed

+134
-4
lines changed

src/Plotly.NET/Traces/Trace2D.fs

Lines changed: 45 additions & 0 deletions
Large diffs are not rendered by default.

src/Plotly.NET/Traces/Trace3D.fs

Lines changed: 25 additions & 4 deletions
Large diffs are not rendered by default.

src/Plotly.NET/Traces/TraceCarpet.fs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ type TraceCarpetStyle() =
4949
/// </summary>
5050
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover.</param>
5151
/// <param name="Visible">Determines whether or not this trace is visible. If "legendonly", the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible).</param>
52+
/// <param name="Legend">Sets the reference to a legend to show this trace in. References to these legends are "legend", "legend2", "legend3", etc. Settings for these legends are set in the layout, under `layout.legend`, `layout.legend2`, etc.</param>
5253
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
5354
/// <param name="LegendRank">Sets the legend rank for this trace. Items and groups with smaller ranks are presented on top/left side while with `"reversed" `legend.traceorder` they are on bottom/right side. The default legendrank is 1000, so that you can use ranks less than 1000 to place certain items before all unranked items, and ranks greater than 1000 to go after all unranked items.</param>
5455
/// <param name="LegendGroup">Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.</param>
@@ -81,6 +82,7 @@ type TraceCarpetStyle() =
8182
[<Optional; DefaultParameterValue(null)>] ?Name: string,
8283
[<Optional; DefaultParameterValue(null)>] ?Visible: StyleParam.Visible,
8384
[<Optional; DefaultParameterValue(null)>] ?ShowLegend: bool,
85+
[<Optional; DefaultParameterValue(null)>] ?Legend: StyleParam.SubPlotId,
8486
[<Optional; DefaultParameterValue(null)>] ?LegendRank: int,
8587
[<Optional; DefaultParameterValue(null)>] ?LegendGroup: string,
8688
[<Optional; DefaultParameterValue(null)>] ?LegendGroupTitle: Title,
@@ -113,6 +115,7 @@ type TraceCarpetStyle() =
113115
Name |> DynObj.setValueOpt trace "name"
114116
Visible |> DynObj.setValueOptBy trace "visible" StyleParam.Visible.convert
115117
ShowLegend |> DynObj.setValueOpt trace "showlegend"
118+
Legend |> DynObj.setValueOptBy trace "legend" StyleParam.SubPlotId.convert
116119
LegendRank |> DynObj.setValueOpt trace "legendrank"
117120
LegendGroup |> DynObj.setValueOpt trace "opacity"
118121
LegendGroupTitle |> DynObj.setValueOpt trace "legendgrouptitle"
@@ -145,6 +148,7 @@ type TraceCarpetStyle() =
145148
/// </summary>
146149
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover.</param>
147150
/// <param name="Visible">Determines whether or not this trace is visible. If "legendonly", the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible).</param>
151+
/// <param name="Legend">Sets the reference to a legend to show this trace in. References to these legends are "legend", "legend2", "legend3", etc. Settings for these legends are set in the layout, under `layout.legend`, `layout.legend2`, etc.</param>
148152
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
149153
/// <param name="LegendRank">Sets the legend rank for this trace. Items and groups with smaller ranks are presented on top/left side while with `"reversed" `legend.traceorder` they are on bottom/right side. The default legendrank is 1000, so that you can use ranks less than 1000 to place certain items before all unranked items, and ranks greater than 1000 to go after all unranked items.</param>
150154
/// <param name="LegendGroup">Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.</param>
@@ -187,6 +191,7 @@ type TraceCarpetStyle() =
187191
[<Optional; DefaultParameterValue(null)>] ?Name: string,
188192
[<Optional; DefaultParameterValue(null)>] ?Visible: StyleParam.Visible,
189193
[<Optional; DefaultParameterValue(null)>] ?ShowLegend: bool,
194+
[<Optional; DefaultParameterValue(null)>] ?Legend: StyleParam.SubPlotId,
190195
[<Optional; DefaultParameterValue(null)>] ?LegendRank: int,
191196
[<Optional; DefaultParameterValue(null)>] ?LegendGroup: string,
192197
[<Optional; DefaultParameterValue(null)>] ?LegendGroupTitle: Title,
@@ -229,6 +234,7 @@ type TraceCarpetStyle() =
229234
Name |> DynObj.setValueOpt trace "name"
230235
Visible |> DynObj.setValueOptBy trace "visible" StyleParam.Visible.convert
231236
ShowLegend |> DynObj.setValueOpt trace "showlegend"
237+
Legend |> DynObj.setValueOptBy trace "legend" StyleParam.SubPlotId.convert
232238
LegendRank |> DynObj.setValueOpt trace "legendrank"
233239
LegendGroup |> DynObj.setValueOpt trace "legendgroup"
234240
LegendGroupTitle |> DynObj.setValueOpt trace "legendgrouptitle"
@@ -271,6 +277,7 @@ type TraceCarpetStyle() =
271277
/// </summary>
272278
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover.</param>
273279
/// <param name="Visible">Determines whether or not this trace is visible. If "legendonly", the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible).</param>
280+
/// <param name="Legend">Sets the reference to a legend to show this trace in. References to these legends are "legend", "legend2", "legend3", etc. Settings for these legends are set in the layout, under `layout.legend`, `layout.legend2`, etc.</param>
274281
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
275282
/// <param name="LegendRank">Sets the legend rank for this trace. Items and groups with smaller ranks are presented on top/left side while with `"reversed" `legend.traceorder` they are on bottom/right side. The default legendrank is 1000, so that you can use ranks less than 1000 to place certain items before all unranked items, and ranks greater than 1000 to go after all unranked items.</param>
276283
/// <param name="LegendGroup">Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.</param>
@@ -317,6 +324,7 @@ type TraceCarpetStyle() =
317324
[<Optional; DefaultParameterValue(null)>] ?Name: string,
318325
[<Optional; DefaultParameterValue(null)>] ?Visible: StyleParam.Visible,
319326
[<Optional; DefaultParameterValue(null)>] ?ShowLegend: bool,
327+
[<Optional; DefaultParameterValue(null)>] ?Legend: StyleParam.SubPlotId,
320328
[<Optional; DefaultParameterValue(null)>] ?LegendRank: int,
321329
[<Optional; DefaultParameterValue(null)>] ?LegendGroup: string,
322330
[<Optional; DefaultParameterValue(null)>] ?LegendGroupTitle: Title,
@@ -363,6 +371,7 @@ type TraceCarpetStyle() =
363371
Name |> DynObj.setValueOpt trace "name"
364372
Visible |> DynObj.setValueOptBy trace "visible" StyleParam.Visible.convert
365373
ShowLegend |> DynObj.setValueOpt trace "showlegend"
374+
Legend |> DynObj.setValueOptBy trace "legend" StyleParam.SubPlotId.convert
366375
LegendRank |> DynObj.setValueOpt trace "legendrank"
367376
LegendGroup |> DynObj.setValueOpt trace "legendgroup"
368377
LegendGroupTitle |> DynObj.setValueOpt trace "legendgrouptitle"

0 commit comments

Comments
 (0)