SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components

All Answers » Re: Different datapoint markers on the same dataseries. » Comments for "Re: Different datapoint markers on the same dataseries."
  • Robert Evans
    Thanks Andrew, I'll try out these options.
  • Andrew Burnett-Thompson
    Hi Robert, for metadata on hover, please see this thread https://www.scichart.com/questions/question/correlating-metadata-with-datapoints
  • Robert Evans
    Hi Andrew, I've been going down the XyScatterRenderableSeries route, but I've run into an issue. I can plot the data, but it's all invisible because I can't set the PointMarker from the code. I need to do it from the code because the chart is dynamic, i.e. I add series and data on the fly, and xaml is too static. I found this question from two years ago: https://www.scichart.com/questions/question/using-xyscatterrenderableseries-with-chartseriesviewmodel which had the same problem, but the solution looks kind of complex. Do you know if there is a better way to do it today? Thanks again.
  • Robert Evans
    Actually never mind, I just found the Abt.Controls.SciChart.Visuals.PointMarkers namespace: new XyScatterRenderableSeries { PointMarker = new Abt.Controls.SciChart.Visuals.PointMarkers.CrossPointMarker(), DataSeries = series };
  • Andrew Burnett-Thompson
    Hi Robert, That's the trick. Also note you can create your own point markers, just inherit BasePointMarker and override DrawInternal(), e.g. CrossPointMarker is implemented like this 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))); } }
  • Robert Evans
    I've got a solution that works for me - I used a FastLineRenderableSeries and three separate XyScatterRenderableSeries (one for each kind of point marker). Using separate XyScatterRenderableSeries means that I can change the shape as well as the colours of the point markers. I haven't implemented tooltips over the scatter points yet, but I guess I can do that with the Hit test API.