ChartJS - adding scroll to horizontal legend in Line chart

一笑奈何 提交于 2020-01-07 03:35:10

问题


I am creating project with ChartJs, and I am fetching real time data from the server. Each second, I add extra data point. After some time, there is just too many points on the graph, to the point that you cannot see anything. I would like to know, if there is a way to scroll through the x-variables, and always have set distance between the points? As of know, the distance between points is shrinking, making the graph not readable.

Thanks!


回答1:


I would like to know, if there is a way to scroll through the x-variables,

You can use .removeData( ) to remove the (current) first set of points. This would keep only the same number of (latest) points visible on the graph.

...and always have set distance between the points?

Unless you remove points maintain a set distance while adding points would cause the graph width to increase - which is usually not what you want to do.



来源:https://stackoverflow.com/questions/33296026/chartjs-adding-scroll-to-horizontal-legend-in-line-chart

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!