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!
- Egor asked 10 years ago
- last edited 10 years ago
- You must login to post comments
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!
- Andrew Burnett-Thompson answered 10 years ago
- last edited 10 years ago
-
Thank you for the answer. I'll try this method soon and write about the result.
-
This method works. Thank you!
- You must login to post comments
Please login first to submit.