Zend Certified Engineer

phpguru.org

Free PHP, Javascript and C# code


HTML5 Goodies

Warning: The only browser these examples seem to work fully on is Firefox.

HTML5 canvas Scatter graphs

The ScatterGraph.js is dragged in using this:

<script type="text/javascript" src="ScatterGraph.js"></script>

And then the code is thus...

<script type="text/javascript">
<!--
    data = [
             [5,5], [13, 89], [36, 67], [45,45], [67,55], [78,19], [14,20], [20,12], [12,34],
             [3,5], [19, 78], [23, 5], [20,1], [16,1], [15,15], [13,10], [10,12], [12,3],
             [6,9], [7,9], [8,9], [90,80], [27,18], [19,30], [21,42], [48,38], [10,15]
           ];
    sg = new ScatterGraph(document.getElementById("myCanvas"), data);
    sg.barColor1 = '#fff';
    sg.barColor2 = '#fff';
    sg.gridColor = '#eee';
    sg.Draw();
// -->
</script>
You need at least MSIE8...