SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components
Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!
Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.
Sure, all you need to do is to add a TextAnnotation to your chart and to set TextAnnotation.Text = RenderableSeries.DataSeries.SeriesName.
I suggest doing this inside the SciChartSurface.RenderedEvent and repositioning as you zoom and pan.
To position the annotation, set X1,Y1 equal to a point just below the line. You can use the following API to determine the location where to put the annotation:
var xRange = renderableSeries.XAxis.VisibleRange; var visiblePoints = renderableSeries.DataSeries.GetIndicesRange(xRange); // Compute the X-Value at the end (right) of the viewport // To compute left, use visiblePoints.Min instead var xValue = (IComparable)renderableSeries.DataSeries.XValues[visiblePoints.Max]; // Compute the Y-value at the end (right) of the viewport // To compute left, pass new Point(0,0) instead var hitTest = renderableSeries.VerticalSliceHitTest(new Point(SciChartSurface.ModifierSurface.ActualWidth - 1, 0), true); var yValue = hitTest.YValue; // Set X,Y value of TextAnnotation textAnnotation.X1 = xValue; textAnnotation.Y1 = yValue; // Set alignment of TextAnnotation textAnnotation.HorizontalAnchorPoint = HorizontalAnchorPoint.Right; textAnnotation.VerticalAnchorPoint= VerticalAnchorPoint.Top;
Let me know if this helps,
Please login first to submit.