Skip to content
Advertisement

Data graphing with html [closed]

A line chart that updates every couple of seconds and doesn’t need the page to be refreshed would be the goal (it would get the info from a separate file that updates on a server). Are any JavaScript libs(other than JQuery) that will make this is easy? Could anyone show an example on a webpage?

The data gets updated on a fixed interval. If possible the preference would be to use only CSS HTML5 and javascript.

Advertisement

Answer

There are several charting libraries that can be used : gRaphael, Highcharts and the one mentioned by others. These libraries are quite easy to use and well-documented (lets say 1 on the difficulty scale).

AFAIK, these libs are not “real-time” because they don’t give the possibility to add new points on the fly. To add new point, you need to redraw the full chart. But I think this is not a problem because redrawing the chart is fast. I’ve made some tries with gRaphael and I didn’t notice any problem with this approach. If you update rate is 10s that should work ok (but it may depends on the complexity of your charts).

If redrawing the full chart is a problem, you may have to develop a chart by yourself with a vector graphics lib like Raphael or paper.js. That will be a bit harder than using a charting lib but should be feasible. (Let say 5 on the difficulty scale).

As you are getting the data on a fixed intervall, you can use a regular ajax lib. jQuery is ok for me but there are some other choices. That may not be the best choice for a non-fixed interval and in this case you may have to look at something like socket.io but it would have consequences on the server side too.

Note1: Raphael, gRaphael and Highcharts are not purely HTML5 but SVG/VML but I guess this is an acceptable choice too.

Note2: it seems that Highchart doesn’t require to redraw the chart when inserting new points. See http://www.highcharts.com/documentation/how-to-use#live-charts

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement