DHTMLX Docs & Samples Explorer

Example (Stacked Vertical Bar)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>Stacked Vertical Bar</title>
	<script src="../../codebase/dhtmlxchart.js" type="text/javascript"></script>
	<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxchart.css">
		<script>
	var data = [
		{ sales:"3.0",sales1:"3.4",sales2:"1.2",sales3:"6.9", year:"2000" },
		{ sales:"5.0",sales1:"5.0",sales2:"5.0",sales3:"5.0", year:"2001" },
		{ sales:"3.4",sales1:"4.7",sales2:"1.9",sales3:"5.5", year:"2002" }
	];
		window.onload = function(){
	var barChart =  new dhtmlXChart({
		view:"stackedBar",
		container:"chart_container",
	    value:"#sales#",
		label:"#sales#",
		width:30,
		xAxis:{
			title:"Year",
			template:"#year#"
		},
		yAxis:{
			title:"Sales per year"
		},
		gradient:"3d",
		color: "#00FF22"
 
	})
	barChart.addSeries({
	    value:"#sales1#",
		color:"#FFFF00",
		label:"#sales1#",
	});
	barChart.addSeries({
	    value:"#sales2#",
		color:"#ff520c",
		label:"#sales2#",
	});
	barChart.addSeries({
	    value:"#sales3#",
		color:"#66ffcc",
		label:"#sales3#",
	});
	barChart.parse(data,"json");
	}
	</script>
</head>
<body >
	<h1>Stacked Vertical Bar</h1>
 
	<div id="chart_container" style="width:500px;height:300px;;border:1px solid #A4BED4;"></div>
</body>
</html>