Simple Line Graph
A snippet of JavaScript that can be embedded in other projects to draw basic line graphs. The snippet should be able to print a line graph from data generated from a PHP script or other source. The input data should be in a comma-separated format like:
color,num1,num2,num3…
For example, the following input would result in two lines in the graph:
blue,10,20,30,50
red,90,70,40,20
In this example, the blue line would be increasing from left-to-right while the red line would decrease. The points from each value should be evenly spaced on the graph, with a line connecting the points.
The graph should include a legend on the left-side for the data values. In the example above, a good legend would be: 10, 20, 30, 40, 50, 60, 70, 80, 90, 100.
The snippet should be able to draw an unlimited number of lines, each with an unlimited number of values. Although this will obviously be restricted by the computing power of the PC running the code, the code itself should not set these limits.
I will need to have exclusive ownership and rights to this source code, and it must not be encrypted in any way.



