Login   Register  
Icontem

File: example_bars.html

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Arturs Sosins  >  Easy Chart  >  example_bars.html  >  Download  
File: example_bars.html
Role: Example script
Content type: text/plain
Description: Bars type example
Class: Easy Chart
Display several types of charts in Canvas
Author: By
Last change:
Date: 2011-08-10 13:51
Size: 1,674 bytes
 

Contents

Class file image Download
<!--
/*************************************************************
 * 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:"bars", 
	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>