<!--
/*************************************************************
* This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com
* Feel free to distribute and modify code, but keep reference to its creator
*
* Easy chart package allows you to easily draw chart from provided data.
* It supports line, scatter, columns, bars and pie chart types
* IT is also possible to set events for interaction with chart data
*
* For more information, examples and online documentation visit:
* http://webcodingeasy.com/JS-classes/Generate-charts-using-HTML5-canvas
**************************************************************/
-->
<html>
<head>
</head>
<body>
<div id='chart_div' style='float: left; margin-right: 20px;'></div>
<div id='legend'></div>
<script src="./chart.packed.js" type="text/javascript"></script>
<script>
var c = new chart("chart_div", {
type:"columns",
onclick: function(value, label){
alert(label + "(" + value + ")");
},
onmouseover: function(value, label){
var canv = document.getElementById("chart_div");
canv.style.cursor = "pointer";
canv.style.cursor = "hand";
var l = document.getElementById("legend");
l.innerHTML = "<p>Label: " + label + "</p><p>Value: " + value + "</p>";
},
onmouseout: function(value, label){
var canv = document.getElementById("chart_div");
canv.style.cursor = "default";
document.getElementById("legend").innerHTML = "";
},
width: 800,
height: 600
});
c.add(10, "green", "Green one");
c.add(50, "red", "Fifty Fifty");
c.add(80, "blue", "80! Enough?");
c.add(100, "yellow", "One hundret");
c.draw();
</script>
</body>
</html> |