Pre loader

How to find the currently visible extents of the X axis

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

Hi, I’m trying to position vertical line annotations on a chart. I want to position them on a visible part of the chart, but I need to use the Absolute coordinate mode as I want the annotation to move with the data as the chart is panned or zoomed.

My question is then: how can I find the currently visible extents of the X axis? If the chart is zoomed or panned I need to know what the left and rightmost visible X-axis values are (independent of the data).

  • You must to post comments
Best Answer
0
0

Hi Robert,

If you just wish to place an annotation on the chart at a relative coordinate (e.g. 20% along the visible XAxis), then please use AnnotationBase.CoordinateMode.

Annotation CoordinateMode

Gets or sets the AnnotationCoordinateMode to use when placing the annotation. E.g. the default of Absolute requires that X1,Y1 coordinates are data-values. The value of Relative requires that X1,Y1 are double values from 0.0 to 1.0

AnnotationCoordinateMode Enumeration

  • Absolute, requires that coordinates X1,Y1,X2,Y2 are data-values
  • Relative, requires that coordinates X1,Y1,X2,Y2 are double values between 0.0 and 1.0
  • RelativeX, requires that coordinates X1,X2 are double values between 0.0 and 1.0, whereas Y1,Y2 are data-values
  • RelativeY, requires that coordinates Y1,Y2 are double values between 0.0 and 1.0, whereas X1,X2 are data-values

For a detailed description of the Annotations API, please see our article Annotations are Easy!

Axis VisibleRanges

Alternatively, you can access which parts of the data are visible via the AxisBase.VisibleRange property.

  • For a NumericAxis this is a Doublerange, which corresponds to data values
  • For a DateTimeAxis this is a DateRange, which corresponds to data values
  • For a TimeSpanAxis this is a TimeSpanRange, which corresponds to data values
  • For a CategoryDateTimeAxis, this is an IndexRange, which corresponds to indices to data values.

Also, please see the Axis.VisibleRangeChanged event which is fired whenever the range changes.

Best regards,
Andrew

  • Robert Evans
    Thanks Andrew, it looks like the AxisBase.VisibleRange property is exactly what I need.
  • Andrew Burnett-Thompson
    Glad to be of help! :) Please mark as answer if this helped you.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.