Pre loader

Having the TimeSpan X-Axis grow by X seconds whenever the data reaches current X-Axis limit

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


For my chart, I create a TimeSpanAxisViewModel with a VisibleRangeLimit like this…

VisibleRange = new TimeSpanRange(new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 30))    
VisibleRangeLimit = new TimeSpanRange(new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 30))
AutoRange = AutoRange.Never

Which properly shows the chart as having 30 seconds of time. Data is added to the chart and it displays as expected.

However, once that data reaches the 30-second limit I’m trying to increase the range by 30 more seconds.

I have a timer that evaluates the elapsed time of a Stopwatch and when that Stopwatch is greater than the current limit (30 seconds) I add to the maximum limit.

Kind of like this…

// If the stopwatch is greater than current range
if (MyStopwatch.Elapsed.TotalSeconds > VisibleRangeSeconds) {

    VisibleRangeSeconds += 30;

    TimeSpan minimumTime = new TimeSpan(0);
    TimeSpan maximumTime = new TimeSpan(0, 0, VisibleRangeSeconds);

    XAxes[0].VisibleRange = new TimeSpanRange(min: minimumTime, max: maximumTime);
    XAxes[0].VisibleRangeLimit = new TimeSpanRange(min: minimumTime, max: maximumTime);


I also noticed that VisibleRangeLimit was being updated after the Stopwatch became longer but VisibleRange was staying the same. It wasn’t being updated and I’m not sure why.

What could I be missing that would make the chart grow to the new maximum time?

  • You must to post comments
Best Answer

From the code sample you’ve given me, it is possible that by setting VisibleRange before VisibleRangeLimit, the chart won’t update to the new desired range (as it’s outside the limit).

I can’t be sure, I haven’t tested this exact combination.

However, I can say there are many examples close to what you want in our Examples Suite, and one in particular here:

How to Create a Scrolling Strip Chart in SciChart?

Code for the example is here.

Best regards,

  • You must to post comments

Setting the VisibleRange before VisibleRangeLimit was the exact problem. Now, everything works as expected. Thanks so much!

  • Andrew Burnett-Thompson
    That pesky VisibleRangeLimit, limiting the visible range like that! Hah! Just kidding, thanks and have a good day :)
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.