Skip to content

,System.Func{--0,System.Object},System.Func{--0,System.Object},System.Boolean)}

LiveChartViewModel.InitializeGenericPlotLines(IEnumerable, Func?, Func, bool) method

Defined in

Type: LiveChartViewModel Namespace: CrissCross.WPF.Plot Assembly: CrissCross.WPF.Plot.dll

Applies to

net10.0-windows10.0.19041, net9.0-windows10.0.19041, net8.0-windows10.0.19041, net481

public void InitializeGenericPlotLines<T>(IEnumerable<T> data, Func<T, object>? getYAxis, Func<T, object> createPlotUI, bool isXAxisDateTime)

View source

Summary: Initializes and configures up to 16 plot lines in the chart using the provided data and UI creation logic, assigning each plot line to the appropriate Y-axis and setting up the X-axis as either date/time or numeric points.

Type parameters

NameDescription
TThe type of the data items to be plotted. Each item represents a single plot line.

Parameters

NameTypeDescription
dataIEnumerableThe collection of data items to be plotted. Cannot be null. A maximum of 16 items will be processed.
getYAxisFunc?A function that determines the Y-axis assignment for each data item. Returns either an integer index or an observable of integer indices. Cannot be null.
createPlotUIFuncA function that creates the plot line UI element for each data item. Cannot be null.
isXAxisDateTimeboolSpecifies whether the X-axis should be configured for date/time values (true) or numeric points (false).

Remarks

If more than 16 data items are provided, only the first 16 will be plotted. Each plot line is assigned to a Y-axis based on the value returned by getYAxis. If an observable is returned, the plot line will update its Y-axis assignment dynamically as the observable emits new values. The method clears existing chart content before initializing new plot lines.

Exceptions

TypeCondition
System.ArgumentNullExceptionThrown if data, getYAxis, or createPlotUI is null, or if a plot UI element cannot be created for a data item.
System.IndexOutOfRangeExceptionThrown if the Y-axis index provided by getYAxis is less than zero or greater than or equal to the number of available Y-axes.