Pre loader

How can axes be adaptive for different dataset?

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
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.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies