Skip to content

Commit

Permalink
#406: Add legend attribute to all traces
Browse files Browse the repository at this point in the history
- this enables setting legend anchors on trace generation
- additionally, fix `coloraxis` atribute name on some 3D traces
  • Loading branch information
kMutagene committed Oct 24, 2023
1 parent f2c1864 commit a776f77
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 4 deletions.
45 changes: 45 additions & 0 deletions src/Plotly.NET/Traces/Trace2D.fs

Large diffs are not rendered by default.

29 changes: 25 additions & 4 deletions src/Plotly.NET/Traces/Trace3D.fs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/Plotly.NET/Traces/TraceCarpet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type TraceCarpetStyle() =
/// </summary>
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover.</param>
/// <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>
/// <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>
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
/// <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>
/// <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>
Expand Down Expand Up @@ -81,6 +82,7 @@ type TraceCarpetStyle() =
[<Optional; DefaultParameterValue(null)>] ?Name: string,
[<Optional; DefaultParameterValue(null)>] ?Visible: StyleParam.Visible,
[<Optional; DefaultParameterValue(null)>] ?ShowLegend: bool,
[<Optional; DefaultParameterValue(null)>] ?Legend: StyleParam.SubPlotId,
[<Optional; DefaultParameterValue(null)>] ?LegendRank: int,
[<Optional; DefaultParameterValue(null)>] ?LegendGroup: string,
[<Optional; DefaultParameterValue(null)>] ?LegendGroupTitle: Title,
Expand Down Expand Up @@ -113,6 +115,7 @@ type TraceCarpetStyle() =
Name |> DynObj.setValueOpt trace "name"
Visible |> DynObj.setValueOptBy trace "visible" StyleParam.Visible.convert
ShowLegend |> DynObj.setValueOpt trace "showlegend"
Legend |> DynObj.setValueOptBy trace "legend" StyleParam.SubPlotId.convert
LegendRank |> DynObj.setValueOpt trace "legendrank"
LegendGroup |> DynObj.setValueOpt trace "opacity"
LegendGroupTitle |> DynObj.setValueOpt trace "legendgrouptitle"
Expand Down Expand Up @@ -145,6 +148,7 @@ type TraceCarpetStyle() =
/// </summary>
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover.</param>
/// <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>
/// <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>
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
/// <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>
/// <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>
Expand Down Expand Up @@ -187,6 +191,7 @@ type TraceCarpetStyle() =
[<Optional; DefaultParameterValue(null)>] ?Name: string,
[<Optional; DefaultParameterValue(null)>] ?Visible: StyleParam.Visible,
[<Optional; DefaultParameterValue(null)>] ?ShowLegend: bool,
[<Optional; DefaultParameterValue(null)>] ?Legend: StyleParam.SubPlotId,
[<Optional; DefaultParameterValue(null)>] ?LegendRank: int,
[<Optional; DefaultParameterValue(null)>] ?LegendGroup: string,
[<Optional; DefaultParameterValue(null)>] ?LegendGroupTitle: Title,
Expand Down Expand Up @@ -229,6 +234,7 @@ type TraceCarpetStyle() =
Name |> DynObj.setValueOpt trace "name"
Visible |> DynObj.setValueOptBy trace "visible" StyleParam.Visible.convert
ShowLegend |> DynObj.setValueOpt trace "showlegend"
Legend |> DynObj.setValueOptBy trace "legend" StyleParam.SubPlotId.convert
LegendRank |> DynObj.setValueOpt trace "legendrank"
LegendGroup |> DynObj.setValueOpt trace "legendgroup"
LegendGroupTitle |> DynObj.setValueOpt trace "legendgrouptitle"
Expand Down Expand Up @@ -271,6 +277,7 @@ type TraceCarpetStyle() =
/// </summary>
/// <param name="Name">Sets the trace name. The trace name appear as the legend item and on hover.</param>
/// <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>
/// <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>
/// <param name="ShowLegend">Determines whether or not an item corresponding to this trace is shown in the legend.</param>
/// <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>
/// <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>
Expand Down Expand Up @@ -317,6 +324,7 @@ type TraceCarpetStyle() =
[<Optional; DefaultParameterValue(null)>] ?Name: string,
[<Optional; DefaultParameterValue(null)>] ?Visible: StyleParam.Visible,
[<Optional; DefaultParameterValue(null)>] ?ShowLegend: bool,
[<Optional; DefaultParameterValue(null)>] ?Legend: StyleParam.SubPlotId,
[<Optional; DefaultParameterValue(null)>] ?LegendRank: int,
[<Optional; DefaultParameterValue(null)>] ?LegendGroup: string,
[<Optional; DefaultParameterValue(null)>] ?LegendGroupTitle: Title,
Expand Down Expand Up @@ -363,6 +371,7 @@ type TraceCarpetStyle() =
Name |> DynObj.setValueOpt trace "name"
Visible |> DynObj.setValueOptBy trace "visible" StyleParam.Visible.convert
ShowLegend |> DynObj.setValueOpt trace "showlegend"
Legend |> DynObj.setValueOptBy trace "legend" StyleParam.SubPlotId.convert
LegendRank |> DynObj.setValueOpt trace "legendrank"
LegendGroup |> DynObj.setValueOpt trace "legendgroup"
LegendGroupTitle |> DynObj.setValueOpt trace "legendgrouptitle"
Expand Down
Loading

0 comments on commit a776f77

Please sign in to comment.