Pre loader

FastLineRenderableSeries real time population

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

1
0

Hi, i have follow the guide to create a chart but i would insert data every 1 second in a Line chart… i have do it but this is the result.

Version
1.2.0.1455
Attachments
Images
  • You must to post comments
1
1

Hi Paolo,

I took a look on your code and found the problem in insertData() method:

 public void insertData() {
    Random random = new Random();

    long xValue = new Date().getTime() + DateIntervalUtil.fromDays(day);
    xValues.add(new Date(xValue));
    yValues.add(random.nextDouble());

    //the data values can be appended to the DataSeries
    dataSeries.append(xValues, yValues);
    day++;

    setZoomExtents(chartSurface_1);
}

When you append xValues and yValues they contain all previously added values. So first call of insertData() will append 1 data point, second will append 2 points(1 from previous call and 1 new data point), third call will append 3 points(2 from previous call and 1 new data point) and so on.

To fix this issue you just need to clear xValues/yValues collection before adding new points:

xValues.clear(); 
yValues.clear();

Hope it helps!

  • 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