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


Is there solution to always display series name below the line on the chart, not in legen, but I need to hide legend and I do not know what is series name. Thank You

  • You must to post comments

Hi there,

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,

Best regards,

  • Tim Rutter
    in the above answer, waht is renderableSeries? I’m unable to find any object that has VerticalSliceHitTest as a function
  • Tim Rutter
    ah i think it should be renderableSeries.HitTestProvider.VerticalSliceHitTest
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.