Pre loader

Zoom Extents that includes annotations



I’ve been wondering. In SciChart’s current WPF version, is there any way to configure the default ViewportManager (or create a new customized one in a simple way) such that whenever I call its ZoomExtents method, the X and Y axes’ ranges will include any custom annotations I’ve added to the chart’s annotations collection?

My custom annotations are basically Images, with fixed Width and Height, and I set their X1 and Y1 properties to hold certain data points I have on the chart. The issue is, I need axes’ ranges to include the Image in it’s entirety, meaning I would have to somehow convert their Widths and Heights to “data point values”, since the new visible range should be in terms of data values, if I’m not mistaken.

Any good example to how this could be done?

  • You must to post comments

Hi there,

Yes there is a way to do this, there is a related question here: Zoom including annotations.

Does this help?

Best regards,

  • Daniel Black
    Like in the original question that this question links to, the provided code will work fine for calling ZoomExtents() on the surface, however if you call IAxis.Zoom, to narrow the visible range for example, then that stops working correctly. One workaround I tried was making my own axis class deriving from NumericAxis, and overriding GetMaximumRange() for it, using the same calls as in the custom viewport manager. It works for the X Axis, but since the Y Axis calls GetWindowedYRange which is not virtual, can’t do this workaround for the Y Axis. If GetWindowedYRange was made virtual then it would be possible
  • 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