SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
Hi,
I have multiple dataseries of around 20,000 points each, and the calculation of each point originates from one of three sources. I would like to show, for each point, a different data point marker depending on the origin of the point. Each point marker should also show some meta data about the calculation origin in a tooltip when it is moused over.
I have been able to achieve this effect using the Annotations API, as shown here: http://s4.postimg.org/otgc4yk3x/markers.png but chart performance grinds to a halt with an AnnotationCollection of up to 100,000 annotations attached to the surface.
Can I show this information in another way that will be performant, taking advantage of virtualisation, efficient algorithms on sorted data etc.? I was thinking that I may be able to add the point origins as metadata to the XyDataSeries, benefit from the performance optimisations that come with a SciChart series, and show the metadata in DataPointMarkers with tooltips? Could this work? Can I also have a differently shaped datapoint marker for each point depending on the metadata?
Thanks đŸ™‚
Hi Robert,
Sounds like this might benefit from one of the following APIs in SciChart:
PaletteProvider API
The PaletteProvider API allows you to draw a different colour for each data-point of a series. Supported series in v3.2 include Line, Column, Mountain, Scatter, Candlestick, Ohlc. In v3.1 fewer series are supported.
You can see an overview of the API at Change Series Colour Dynamically (PaletteProvider) and a live demo at the Using PaletteProvider Example.
If you use this technique, I would propose having a FastLineRenderableSeries and separate XyScatterRenderableSeries which has the same data and a palette provider to colour the points.
CustomRenderableSeries API
Using our RenderContext you can draw to the screen directly. Please see CustomRenderableSeries API Overview and Creating a Custom Spline Line Series.
If you scroll down to the section Drawing Point Markers it shows how to draw markers at data-points.
If you use this technique I would recommend inheriting FastLineRenderableSeries and re-using the base.InternalDraw() method, but implementing your own code to just draw point markers afterwards.
I hope this helps, and if you get a good solution, feel free to share it so others can benefit!
public class CrossPointMarker : BasePointMarker
{
/// <summary>
/// When overridden in a derived class, draws the point markers at specified collection of <see cref="Point" /> centers
/// </summary>
/// <param name="context">The RenderContext to draw with</param>
/// <param name="centers">The Centres of the point markers</param>
/// <param name="pen">The default Stroke pen (if current pen is not set)</param>
/// <param name="brush">The default Fill brush (if current brush is not set)</param>
/// <seealso cref="IRenderContext2D" />
/// <seealso cref="IPen2D" />
/// <seealso cref="IBrush2D" />
protected override void DrawInternal(IRenderContext2D context, IEnumerable<Point> centers, IPen2D pen, IBrush2D brush)
{
foreach (var center in centers)
{
DrawInternal(context, center.X, center.Y, pen, brush);
}
} protected override void DrawInternal(IRenderContext2D context, double x, double y, IPen2D pen, IBrush2D brush)
{
var halfWidth = (float)(Width * 0.5);
var halfHeight = (float)(Height * 0.5); context.DrawLine(pen, new Point((x - halfWidth), y), new Point((x + halfWidth), (y)));
context.DrawLine(pen, new Point(x, (y - halfHeight)), new Point(x, (y + halfHeight)));
}
}
Hi,
This is nearly very useful for us.
What we need is an impulse chart, with different colour and shape per point (as well as the x and y values). So I guess that would require 4 values to be associated with each point, and those four values to all be passed to the GetColor and DrawInternal methods. And it would require the impulse chart type to support the pallette provider api.
Is this functionality that could be added?
Please login first to submit.