SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

Welcome to the SciChart Community Forums!

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.

Answered
0
0

Hi there,

I’m new for this tool and I have a problem to display different datasets for one series dynamically.

I have a dataset name dataset1 with the range of x-axis is from 0 to 30, and the data is from 100 t0 3000. And another dataset named dataset2 with the range of x-axis is from 1 to 10, and the data is from 10 to 100.

Fistly, I load dataset to series A, then it shows as below.
enter image description here

Then, I load dateset2 to the same series A, it shows the series fine, but the axes are not adaptive with the x/y range as below.
enter image description here

My question is how can the axies be adaptive with different datasets? Appreciated for any response! Thank you!
BTW, the sample code I made is attached.

Attachments
Images
  • You must to post comments
Best Answer
0
0

Hi Pippen,

Thank you for your enquiry! It should be really simple, please take a look at our article AutoRange.Once vs. AutoRange.Never vs. AutoRange.Always

When you create a SciChartSurface with X,Y Axes, RenderableSeries and
DataSeries, the default behaviour is what we call ‘AutoRange.Once’.
This means SciChart will attempt to AutoRange on that axis until a
valid visible range has been achieved.

If you change the data, SciChart will not automatically fit the data. There are two ways you can achieve this:

  1. You can call sciChartSurface.ZoomExtents(). This zooms the chart to fit the new data once.
  2. You can set sciChartSurface.YAxis.AutoRange = AutoRange.Always (also XAxis). When data changes, SciChart will always zoom to fit the data.

Just note that zooming, panning is incompatible with option (2) above. To zoom and pan while auto-ranging you need a more complex technique, which is discussed here: How to have a fixed scrolling time range which works with modifiers

Hope this helps!

Best regards,
Andrew

  • Pippen Liu
    Thank you Andrew. It works for me.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.