Monday, July 28, 2008

parkline Creation : SVG and Javascript


Sparkline Creation : SVG and Javascript

et the javascript here.

include it at the top of your html with:
<script type="text/javascript" src="sparklines.js">





to get this:   

do this
<script>
     insertSparkline([1,3,5,-3,10]);
</script>

to get this:   

do this
<script>
     myDataToPlot=[1,3,5,-3,10, 14, 15, 9, 7, 11, 5, 4, -3, -5, -10, 4, 7, 12];
     myParameters={
                              "height":20,
                              "width":200,
                              "output":"write",
                              "lineColor":"red",
                              "lineWeight":4,
                              "showMin":true,
                              "minColor":"red",
                              "showMax":true,
                              "maxColor":"green",
                              "showEndPoint":true,
                              "endPointColor":"blue",
                              "showEndValue":true,
                              "endValueColor":"black"
                           }
     insertSparkline(myDataToPlot, myParameters);
</script>


 

No comments: