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.
- Sven Fink asked 9 years ago
- You must login to post comments
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
- Andrew Burnett-Thompson answered 9 years ago
- last edited 9 years ago
-
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. :-)
-
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 login to post comments
Please login first to submit.