SharpPlot Reference > SharpPlot Methods > SplitBy Method

SharpPlot.SplitBy Method

Enables series to be split into multiple series according to some criterion prior to plotting. May be called more than once to split according to multiple criterions.

If categories are not provided, then the split series use the unique values in the order in which they appear.

If categories are provided, then they determine the split series order. Integer values for string categories are expected to range from 1 to N where N is the number of categories. Boolean values map true to the first category and false to the second category (any other category will therefore be empty)

SplitBy generally sets relevant text (unless explicitly set by user) such as Series name, Key text to the categories of the split.


sp.SplitBy(new int[]{2,1,1,1,2}); // first and last items are run in a separate series, before the middle values
sp.SplitBy(new int[]{2,1,1,1,2}, new int[]{1,2}); // force to run the middle series first, then the edge items
sp.SplitBy(new int[]{2,1,3,1,2}, new int[]{1,2}); // third item is excluded from series (has no matching category)

See the tutorial on grouping and splitting data for more examples.


See also ...

Grouping and Splitting database data | SharpPlot Members

Send comments on this topic
© Dyalog Ltd 2021