Pre loader

Custom point markers

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

Answered
1
0

Hello again!
I’m using new SciChart 3.2 Beta version. In the 3.1 version I had this code snippet to draw (only one) point marker:

protected override void DrawInternal(IRenderContext2D context, IEnumerable<Point> centers, IPen2D pen, IBrush2D brush)
        {
            var viewportRect = new Rect(new Point(0, 0), context.ViewportSize);

            float width = (float)Width;
            float height = (float)Height;
            Point lastPoint = new Point();
            var custBrush = context.CreateBrush(new SolidColorBrush(Colors.White));
            foreach (var center in centers)
            {
                if (IsInBounds(center, width, height, viewportRect))
                {
                    lastPoint=new Point(center.X,center.Y);
                }
            }
            context.FillRectangle(custBrush, new Point(lastPoint.X - 100, lastPoint.Y), new Point(lastPoint.X - 100 + NameToDisplay.Length * 4 * (FontSize / 8.0), lastPoint.Y + 20 * (FontSize / 8.0)), 0);
            context.DrawText(new Rect(lastPoint.X - 100, lastPoint.Y, NameToDisplay.Length * 4 * (FontSize / 8.0), 20 * (FontSize / 8.0)), FontColor, FontSize, NameToDisplay);
            custBrush.Dispose();
        }

But in new version all point markers are drawn only with this method :

protected override void DrawInternal(IRenderContext2D context, double x, double y, IPen2D pen, IBrush2D brush)
{....

How can I switch it to draw only by the method with centers (not with single point) , because I need to show only last visible point of renderable series ?
Thanks in advance!

  • You must to post comments
Great Answer
1
0

We depreciated that method due to our work on performance enhancements in SciChart v3.2 (which eliminated IEnumerable throughout the rendering pipeline).

Your best suggestion to draw a single marker at the last point is to override one of our RenderableSeries (or create a CustomRenderableSeries) and draw a single ellipse or marker at the last point of the PointSeries.

You can find out about our CustomRenderableSeries API here, in the articles

I would start by trying to override FastLineRenderableSeries.Draw(), do not use FastLineRenderableSeries.PointMarker (as this will cause the base class to draw a marker, then instead after the base draws, draw a single ellipse using the RenderContext.

Try it! Let us know the result!

  • Egor
    Thank you for the answer. I'll try this method soon and write about the result.
  • Egor
    This method works. Thank you!
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.