You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Plotly.NET.CSharp/GenericChartExtensions.cs
+98-1Lines changed: 98 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
-
usingPlotly.NET;
1
+
usingMicrosoft.FSharp.Core;
2
+
usingPlotly.NET;
2
3
usingPlotly.NET.LayoutObjects;
3
4
usingPlotly.NET.TraceObjects;
4
5
usingSystem.Runtime.InteropServices;
@@ -365,5 +366,101 @@ public static GenericChart.GenericChart WithXAxisRangeSlider(
365
366
rangeSlider:rangeSlider,
366
367
Id:Id.ToOption()
367
368
).Invoke(gChart);
369
+
370
+
/// <summary>
371
+
/// Sets the Legend for the chart's layout
372
+
///
373
+
/// If there is already a Legend set, the objects are combined.
374
+
/// </summary>
375
+
/// <param name="gChart">The chart for which to set the legend</param>
376
+
/// <param name="legend">The new Legend for the chart's layout</param>
377
+
publicstaticGenericChart.GenericChartWithLegend(
378
+
thisGenericChart.GenericChartgChart,
379
+
Legendlegend
380
+
)
381
+
=>
382
+
Plotly.NET.Chart.WithLegend(
383
+
legend:legend
384
+
).Invoke(gChart);
385
+
386
+
/// <summary>
387
+
/// Sets the given Legend styles on the input chart's Legend.
388
+
///
389
+
/// If there is already a Legend set , the styles are applied to it. If there is no Legend present, a new Legend object with the given styles will be set.
390
+
/// </summary>
391
+
/// <param name="gChart">The chart for which to set the legend styles</param>
392
+
/// <param name="BGColor">Sets the legend background color. Defaults to `layout.paper_bgcolor`.</param>
393
+
/// <param name="BorderColor">Sets the color of the border enclosing the legend.</param>
394
+
/// <param name="BorderWidth">Sets the width (in px) of the border enclosing the legend.</param>
395
+
/// <param name="EntryWidth">Sets the width (in px or fraction) of the legend. Use 0 to size the entry based on the text width, when `entrywidthmode` is set to "pixels".</param>
396
+
/// <param name="EntryWidthMode">Determines what entrywidth means.</param>
397
+
/// <param name="Font">Sets the font used to text the legend items.</param>
398
+
/// <param name="GroupClick">Determines the behavior on legend group item click. "toggleitem" toggles the visibility of the individual item clicked on the graph. "togglegroup" toggles the visibility of all items in the same legendgroup as the item clicked on the graph.</param>
399
+
/// <param name="GroupTitleFont">Sets the font for group titles in legend. Defaults to `legend.font` with its size increased about 10%.</param>
400
+
/// <param name="ItemClick">Determines the behavior on legend item click. "toggle" toggles the visibility of the item clicked on the graph. "toggleothers" makes the clicked item the sole visible item on the graph. "false" disables legend item click interactions.</param>
401
+
/// <param name="ItemDoubleClick">Determines the behavior on legend item double-click. "toggle" toggles the visibility of the item clicked on the graph. "toggleothers" makes the clicked item the sole visible item on the graph. "false" disables legend item double-click interactions.</param>
402
+
/// <param name="ItemSizing">Determines if the legend items symbols scale with their corresponding "trace" attributes or remain "constant" independent of the symbol size on the graph.</param>
403
+
/// <param name="ItemWidth">Sets the width (in px) of the legend item symbols (the part other than the title.text).</param>
404
+
/// <param name="Orientation">Sets the orientation of the legend.</param>
405
+
/// <param name="Title">Sets the title of the legend.</param>
406
+
/// <param name="TraceGroupGap">Sets the amount of vertical space (in px) between legend groups.</param>
407
+
/// <param name="TraceOrder">Determines the order at which the legend items are displayed. If "normal", the items are displayed top-to-bottom in the same order as the input data. If "reversed", the items are displayed in the opposite order as "normal". If "grouped", the items are displayed in groups (when a trace `legendgroup` is provided). if "grouped+reversed", the items are displayed in the opposite order as "grouped".</param>
408
+
/// <param name="UIRevision">Controls persistence of legend-driven changes in trace and pie label visibility. Defaults to `layout.uirevision`.</param>
409
+
/// <param name="VerticalAlign">Sets the vertical alignment of the symbols with respect to their associated text.</param>
410
+
/// <param name="X">Sets the x position (in normalized coordinates) of the legend. Defaults to "1.02" for vertical legends and defaults to "0" for horizontal legends.</param>
411
+
/// <param name="XAnchor">Sets the legend's horizontal position anchor. This anchor binds the `x` position to the "left", "center" or "right" of the legend. Value "auto" anchors legends to the right for `x` values greater than or equal to 2/3, anchors legends to the left for `x` values less than or equal to 1/3 and anchors legends with respect to their center otherwise.</param>
412
+
/// <param name="Y">Sets the y position (in normalized coordinates) of the legend. Defaults to "1" for vertical legends, defaults to "-0.1" for horizontal legends on graphs w/o range sliders and defaults to "1.1" for horizontal legends on graph with one or multiple range sliders.</param>
413
+
/// <param name="YAnchor">Sets the legend's vertical position anchor This anchor binds the `y` position to the "top", "middle" or "bottom" of the legend. Value "auto" anchors legends at their bottom for `y` values less than or equal to 1/3, anchors legends to at their top for `y` values greater than or equal to 2/3 and anchors legends with respect to their middle otherwise.</param>
0 commit comments