Skip to content
ChartForgeX
Class

ChartLegendItem

ChartForgeX.Core

Namespace
ChartForgeX.Core
Assembly
ChartForgeX
Modifiers
sealed

An immutable legend entry that does not come from a series, such as a reference line, threshold band or annotation.

Inheritance

  • object
  • ChartLegendItem

Remarks

Custom items follow the series entries. They describe the chart and are never visibility toggles.

Usage

Explore 7 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 1

Methods

public static ChartLegendItem Band(string label, ChartColor color, double fillOpacity = 0.2) #

Creates a filled square key outlined in the item colour, for example for a threshold band or target range.

Parameters

label string required
The legend label.
color ChartForgeX.Primitives.ChartColor required
The band colour.
fillOpacity double = 0.2 optional
The fill opacity from zero through one; one draws a solid swatch.
public static ChartLegendItem Line(string label, ChartColor color, IEnumerable<double>? dash = null, double strokeWidth = 2) #

Creates a line key, for example for a target or reference line.

Parameters

label string required
The legend label.
color ChartForgeX.Primitives.ChartColor required
The line colour.
dash System.Collections.Generic.IEnumerable<double>? = null optional
Optional dash and gap lengths from 0.25 through 1024 chart pixels; null or empty draws a solid line. ChartLegendItem.ReferenceDash matches chart reference lines.
strokeWidth double = 2 optional
The line width, greater than zero and at most eight chart pixels.
public static ChartLegendItem Marker(string label, ChartColor color, ChartMarkerShape shape = Circle) #

Creates a marker key, for example for an annotation or event marker.

Parameters

label string required
The legend label.
color ChartForgeX.Primitives.ChartColor required
The marker colour.
shape ChartForgeX.Core.ChartMarkerShape = Circle optional
The marker shape.
public ChartLegendItem WithKeySize(double size) #

Returns a copy of this item with its own key size.

Parameters

size double required
The key size from 4 through 24 chart pixels.

Properties

public static IReadOnlyList<double> ReferenceDash { get; } #

Gets the dash and gap lengths chart reference lines use by default.

public string Label { get; } #

Gets the label shown beside the key.

public ChartColor Color { get; } #

Gets the key colour.

public ChartLegendKeyShape Key { get; } #

Gets the key shape: ChartLegendKeyShape.Line, ChartLegendKeyShape.Square or ChartLegendKeyShape.Marker.

public ChartMarkerShape MarkerShape { get; } #

Gets the marker shape drawn by a ChartLegendKeyShape.Marker key.

public IReadOnlyList<double>? Dash { get; } #

Gets the dash and gap lengths of a line key, or null for a solid line.

public double StrokeWidth { get; } #

Gets the stroke width of a line key, or of a band key's outline.

public double FillOpacity { get; } #

Gets the fill opacity of a band key.

public double? KeySize { get; } #

Gets the key size in chart pixels, or null to use the legend's key size.