Pre loader

Series name on chart

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

0
0

Hi,
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
0
0

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,
Andrew

  • 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.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies