Pre loader

DataPoint Properties

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

Hi there,

We are looking for a high-performance charting library, hence Im testing scichart and I am very excited about it.

Our application has an very abstract processing mechanism which categorize incoming data and dynamically adds channels to the plot. Each sample is – like we call it – a ProcessedData object which is a base class containing extented information about the sample like “is valid” or “is out of range”. Eg. if measureing a voltage, we need to mark data points on the chart that are “out of range” or similar.
I’d thought to start with the “DragHorizontalThreshold” which uses the RedIfOverThresholdPaletteProvider to change the color of the plot.
Do you have an idea if it is possible to implement a custom PaletteProvider which takes respect of an IsValid-property? Acutally i do not have a clue how to.

Thanks.

  • You must to post comments
0
0

Hi Sven,

It’s a little bit difficult in version 3 of SciChart, since the IPaletteProvider interface accepts X,Y value and returns Color. The interface is declared like this:

Color? OverrideColor(IRenderableSeries series, double xValue, double yValue);

What you can do is do a lookup in the paletteprovider, but this assumes your data has unique X-values. Also, if the data is sorted ascending in X the performance will be OK, but if not, it won’t be good.

public class MyPaletteProvider : IPaletteProvider
{
    // the original data
    public IList<ProcessedData>  ProcessedData { get; set; }

    // Inside your PaletteProvider implementation
    Color? OverrideColor(IRenderableSeries series, double xValue, double yValue)
    {
        // does a fast binary search on index
        int index = series.DataSeries.FindIndex(xValue, SearchMode.Exact); 
        if (index != -1)
        {
               return ProcessedData[i].IsValid ? Colors.Red : Colors:Green;      
        }
    }   
}

You should also see Correlating metadata with datapoints which shows a similar workaround to get additional data into tooltips.

Now something we’re researching right now is adding PointMetadata to the pipeline, e.g. the ability to tag any XY data-point with a business object (any object you define), and pass that through to the Rendering, PaletteProvider and Tooltip stages. That’s a work in progress and will be available soon(ish). More details on that later, but for now, the above workaround should do the trick.

Best regards,
Andrew

  • Sven Fink
    Hi Andrew, Thank you for that quick response. Unfortunately, the workaround is unapplicable. The charts and lines on the plots are dynamically created. Furthermore, there can be N charts, containing M lines, each. MyPaletteProvider needs to figure out, to which chart instance it belongs to (VisualTree?) and after that, it needs to figure out which line it is processing. So, line 13 is going to look like: return ProcessedData[i][j][k].IsValid ? Colors.Red : Colors:Green; But Im looking further for the business object, which seems to solve the problem. Just as a foot node: As far as i dipped in SciChart, I'd like to say; you guys did a realy great job! Since I am evaluating multiple charting libraries, I need to make out, which lib suites our needs. As a result to that, I intend do ask some more questions, if i get stuck on my self-experiment. I apologize. :-)
  • Andrew Burnett-Thompson
    Hi Sven, how so? The paletteprovider can access the RenderableSeries as this is passed in to the OverrideColor method. Why not set the original ProcessedData on RenderableSeries.Tag? Then you can access it directly.
  • 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