Pre loader

Using PaletteProvider with z-value as type corresponding to a color


I have a chart with FastImpulseRenderableSeries.

<s:FastImpulseRenderableSeries StrokeThickness="3" SeriesColor="LawnGreen" x:Name="IdentifiedPeakSeries" YAxisId="PeakAxis">
                      <s:EllipsePointMarker Width="0" Height="0" Fill="LawnGreen"/>

The color of each Impulse depends on a own type of each result. There are three different types which should have color green, yellow and red. In the program I use the XyzDataSeries to set the x and y values of the impulse and the z-value as the type to get the color.

var seriesId2 = new XyzDataSeries<double, double, int>();

for (int i = 0; i < SamplePeakList.Count(); i++)
         seriesId2.Append(SamplePeakList[i].Mass / 1000, SamplePeakList[i].Intensity, peakType);

But the IPaletteProvider has no overridable method with x, y and z value!
How can I pass the impulsetype to the palette provider to set the corresponding color?

  • You must to post comments

Hi Michael,

The PaletteProvider feature is designed to work with X,Y values when you have an X,Y series (e.g. FastLineRenderableSeries, Impulse, Scatter). In v3.2 of SciChart there is a PaletteProvider function which accepts X,Y,Z but it is only called for FastbubbleRenderableSeries.

There are two ways to solve this problem:

  1. You can use PaletteProvider with X,Y and lookup the Z value by calling XyzDataSeries.FindIndex(X), and using that index to lookup XyzDataSeries.ZValues[index]. This method will work but will be slower as each point in the series must perform an index lookup.

  2. Alternatively, you can create a CustomRenderableSeries which draws a thin line up from zero to YValue and a point-marker at the YValue. You can then color the points as you wish. Please note that creating pens can be time-consuming (if StrokeThickness > 1) so its a good idea to cache them.

Do you have what you need to try this out? Please comment on my post if you need more info.

Best regards,

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies