April 4, 2012

Best way to go about making "simple" line graphs with a very light footprint? jquery? canvas?

Question by android.nick

I’m trying to create line graphs like the one in the image below.
Line Graph

It needs to have a very light weight(in kb), and needs to have points that I could hover(for a tooltip about that point, like in the image). I don’t need pie charts or anything like that, just line graphs like above.

I’m just not sure how to go about it best, I don’t know canvas, and i’m assuming that might be pretty complex trying to do what I need with canvas. I know jQuery decently well.

I’m wondering: Is there a very light weight framework/plugin that would allow me to do just the bare essentials like in the image? If not, how would you suggest going about this with jQuery?

All I need are the lines drawn, with points that I could trigger a hover on, I can take care of the tooltip and all that, i’m just trying to figure out how to draw all the lines the match up with the grid, and get the little circle elements in the right position.

Thanks so much.
ps: light weight to me is not more than a few kb, because I want them to be interactive(not just a static image), but i’m not going to have so many of them that I need a huge jquery plugin, just something small.

Also: I’m trying to make it so it’s responsive, and shrinks to fit a phones screen.

Answer by Starx

If you are not planning any manipulation on the graphs. Use a PHP library called pChart

...

Please fill the form - I will response as fast as I can!