I want to make a graph which plots numeric points like (23,45),(32,67) etc using canvas tag in html5. I found this graph in this link / The problem in this graph is that only y-axis works with numeric values.I want to make X-axis work with numeric values as well using the same logic as y-axis...Please help
I want to make a graph which plots numeric points like (23,45),(32,67) etc using canvas tag in html5. I found this graph in this link http://www.worldwidewhat/2011/06/draw-a-line-graph-using-html5-canvas/ The problem in this graph is that only y-axis works with numeric values.I want to make X-axis work with numeric values as well using the same logic as y-axis...Please help
Share Improve this question edited Apr 4, 2013 at 4:09 Lucy asked Mar 29, 2013 at 5:15 LucyLucy 1,85216 gold badges57 silver badges97 bronze badges 2- You need to be a bit more clear. The x axis in that example is already dynamic actually. Check out the demo here Live Demo – Loktar Commented Mar 29, 2013 at 13:49
- i want to make x axis values numeric as well just like y axis.Currently it displays months.I want to plot points in a graph like(55,60) (45,23) using the concepts of the example given in the link i posted. – Lucy Commented Apr 1, 2013 at 3:29
1 Answer
Reset to default 4This is a really easy fix. The as it is graphing, it just references the length of the data instead of the X values. We can work around this easily by adding a getMaxX()
function, and referencing the actual X values. Here is a working example.