Skip to content

ChartChannel

ClassChartGuruChartGuru
public sealed class ChartChannel

Serializable encoding of one visual channel, the equivalent of Swift Charts' .value("Label", value): a data column (or several for wide data) or a constant, plus the display label used for axis titles, legends and tooltips.

public static ChartChannel FromColumn(string column, string label = null)

Binds the channel to one column.

Parameters

Name Type
column System.String
label System.String

Returns

ChartGuru.ChartChannel

public static ChartChannel FromColumns(params string[] columns)

Binds the channel to several columns; each becomes its own series.

Parameters

Name Type
columns System.String[]

Returns

ChartGuru.ChartChannel

public static ChartChannel FromConstant(float value, string label = null)

Binds the channel to a constant number.

Parameters

Name Type
value System.Single
label System.String

Returns

ChartGuru.ChartChannel

public static ChartChannel FromConstant(string value, string label = null)

Binds the channel to a constant written in invariant text.

Parameters

Name Type
value System.String
label System.String

Returns

ChartGuru.ChartChannel

public void SetColumns(params string[] columns)

Binds the channel to the given columns, or clears it when none are given.

Parameters

Name Type
columns System.String[]
public void SetConstant(string value)

Binds the channel to a constant written in invariant text, or clears it when the text is empty. On a Series channel the constant names every mark of the layer as one series.

Parameters

Name Type
value System.String
public void SetLabel(string label)

Sets the display label.

Parameters

Name Type
label System.String
public void Clear()

Clears the channel.

public bool TryGetConstantNumber(out float value)

Tries to read the constant as a number.

Parameters

Name Type
value System.Single

Returns

System.Boolean

public ChartChannel Clone()

Returns a deep copy.

Returns

ChartGuru.ChartChannel

public ChartChannel()

public ChartChannelBinding Binding { get; }

How the channel is bound.

Returns

ChartGuru.ChartChannelBinding

public bool Literal { get; set; }

True when the bound column holds the visual values themselves, like per-mark .symbolSize, .symbol(.square) or .foregroundStyle(.red) modifiers in Swift Charts, instead of values mapped through a scale and shown in the legend. Size reads diameters in points, Symbol reads SymbolShape names and Color reads HTML colors such as #FF3B30; empty cells keep the layer style. Only the Size, Symbol and Color channels read it; the Opacity, Rotation and ClipShape channels always read their values directly.

Returns

System.Boolean

public bool IsBound { get; }

True when the channel reads at least one column or has a constant.

Returns

System.Boolean

public string Column { get; }

The first bound column, or an empty string.

Returns

System.String

public IReadOnlyList<string> Columns { get; }

All bound columns; several columns describe wide data with one series per column.

Returns

System.Collections.Generic.IReadOnlyList{System.String}

public string Constant { get; }

The constant in invariant text.

Returns

System.String

public string Label { get; }

The display label, falling back to the first column name.

Returns

System.String

public string AuthoredLabel { get; }

The explicitly authored label, which may be empty.

Returns

System.String