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.
- Yiğit Arısoy asked 1 month ago
- You must login to post comments
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.
- Andrei Vascul answered 1 month ago
- You must login to post comments
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.
- Yiğit Arısoy answered 1 month ago
- last edited 1 month ago
-
Just to clarify, have you noticed this overhead locally as well?
-
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 login to post comments
Please login first to submit.