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 have a simple columns chart. The user can use a button that will basically change the data entirely.
The chartsurface has SeriesSource binded. Reassigning the series is changing the data on the chart, but the X-Axis is not being refreshed, so the data is showing up on the wrong part of the chart.
I uploaded 2 images to show the problem. In the “after” image, the long column should actually be at the “10+” label. If I open the same data in a new chart it shows correctly.
What’s the best method to entirely refresh a chart’s data?
Thanks in advance
It sounds like your chart is using its default AutoRange behaviour of AutoRange.Auto to detect when to range. Take a look at this article: AutoRange.Never vs AutoRange.Auto vs AutoRange.Always
The default state of the chart is AutoRange.Auto, which means ‘When I start up, autorange the chart if it does not have a valid VisibleRange’.
When you set new data on the chart the old VisibleRange exists on the axis, so the axis believes it is valid. There are a few ways to solve this:
set AutoRange.Always on the axis. This will force it to reset its range each time data changes, but you will not be able to zoom in using Modifiers (since AutoRange overrides mouse-zoom).
call ScIChartSurface.ZoomExtents(), or use a ViewportManager to reset zoom after setting data. In an MVVM scenario this is tricky since you don’t know when the data has bound and you need to zoom to fit after the data is bound.
Give the above suggestions a try and let me know your feedback in the comments.
Please login first to submit.