Pre loader

Problem With Gaps in Line Chart

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

Hello,

I was trying to create a line chart with lots of gaps in it. All lines need to be two points only, with the same y values and x values representing time, with the next value as a NaN to divide the lines. When i did this, the chart started to respond in a weird way where points would disappear when zooming and not even show anything at certain parts.

I modified the example from the documentation in the section titled “Drawing Null points with NaN” as a FastLineRenderableSeries with my input and sharing it below.
The docs I looked at:
https://www.scichart.com/documentation/js/current/webframe.html#DrawingGapsInSeries.html
My Example:
https://codepen.io/Yiit-Arsoy/pen/ExBbBRQ

Is this the optimal way to achieve what I am trying to do here or should i be looking at an alternative solution? I would be trying to draw close to 1 million lines at least, with text annotations.

Thank you for your help.

Version
3.3.592
  • You must to post comments
Best Answer
0
0

Hi Yiğit,

This is due to the xValues containing NaNs as well, which leads to unwanted behaviour, so you can either make the xValues incremental, or double the second prop to the third xValue on each push.

So
xValues.push(startTime, endTime, NaN);
would need to be:
xValues.push(startTime, endTime, endTime);

Here is a CodePen showing the simpler way of doing this: https://codepen.io/vasculandrei/pen/ExBoxKm?editors=0010 , and you can play around with the POINTS variable, although going over 10.000, it looks like a box series, but a real-world dataset would do the trick.

Hope this has helped.

Best,
Andrei Vascul
Software developer, SciChart Ltd.

  • You must to post comments
0
0

Hello,

Thank you very much for your answer and yes that was indeed the cause of the problem.

However, my follow up question is, introducing the NaN values, as it is mentioned in performance tips, reduces the performance of the chart a noticable amount. Would there be any other way of achieving the same effect (Gaps in the data) by some other method, without the performance hit from the NaN values?

Thank you very much for your help.

  • Jim Risen
    Just to clarify, have you noticed this overhead locally as well?
  • Yiğit Arısoy
    Yes, I was able to draw at least twice as many points without any fps drops when there are no NaN values to create the line strips. There is no problem whatsoever when zoomed in of course, this is only when all the points are in the viewport.
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.