SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & 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.
I need to display a chart with a fixed X axis, i.e. with the scale remaining fixed between 0 and 360 with these end values displayed. I have set this in XAML with the SciChartSurface.AutoRangeOnStartup False and implemented InvalidateParentSurface(RangeMode.ZoomToFitY) after drawing the chart but unless the data fills the chart the end values on the scale are not displayed. If I set the VisibleRange to -5, 365 and stretch the chart in the X plane the 360 then the 0 appear, see attached sample.
If I increase the scale values significantly or have large GrowBy values the end values are displayed but this can be messy, depending on the data and leaves large blank areas at each end of the chart. Is there a way round this or should I implement a ZoomExtentsModifier to handle this?
Am I right in thinking that I will need to implement a ZoomExtentsModifier anyway to get this functionality when the user double clicks the chart to zoom extents?
I am using SciChart v220.127.116.115 Hotfix.
Regarding zoom extents behavior to particular bounds, there are several ways to achieve this. You can create custom modifier(or extend existing ZoomExtentsModifier as you mentioned) and put logic which you need here, or you can apply your own ViewportManager to the surface, as described in this post:Zoom including annotations. This feature is designed exactly for such situations.
Concerning first/last values of the scale, this is current axis implementation, we prevent them from being showed deliberately. You could take a look at this topic Setting range and ticks for more info. But there is a workaround, please, take a look at our Drag axis to scale example – notice, that first/last ticks are added manually, so you can add two TextBlocks and bind them to VisibleRange.Min,Max correspondingly.
Hope this helps! Please, feel free to ask if you have more questions or need any assistance with implementation.
I think the easiest way to achieve this is to inherit your ViewportManager from existing DefaultViewportManager and catch VisibleRange changes in OnVisibleRangeChanged(..) method. So, if the chart is zoomed in, you need to call base(default) implementation and if it’s zoomed out, call your own.
Does this make sense in your case?
Please login first to submit.