Animated line graph in Javascript?

2019-03-11 04:38发布

I'd like to do a line-graph on a web-page using Javascript. I want it to be animated so that when the page loads, the line is slowly "drawn" onto the graph.

I've managed to get a static graph working, using flot, however I'm unsure how to animate it.

It would be half my job done to just make it draw a line half-way along the graph, but when I try to do this by modifying the data-set, it modifies the structure of the graph as well, so that the line fills 100% of the graph area.

So is there a way to draw the line data in stages, so I can animate it?

Or alternatively, is there some other javascript graphing framework that I've overlooked?

7条回答
一夜七次
2楼-- · 2019-03-11 05:16

You could modify flot. I've made changes to the flot code before. It's fairly well-written. There's a google group if you get stuck.

Or you could just learn how to use Canvas, which is what flot uses.

查看更多
登录 后发表回答