DHTMLX Docs & Samples Explorer

Example (Using addSeries())

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>Main page</title>
	<script src="../../codebase/dhtmlxchart.js" type="text/javascript"></script>
	<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxchart.css">
		<script>
		var data1 = [
		{ sales:"3.0",sales1:"4.4",sales2:"1.4",sales3:"6.9", year:"2000" },
		{ sales:"4.5",sales1:"3.2",sales2:"2.5",sales3:"7.5", year:"2001" },
		{ sales:"3.4",sales1:"4.7",sales2:"1.9",sales3:"5.5", year:"2002" }
 
	];
		window.onload = function(){
			var barChart =  new dhtmlXChart({
			view:"barH",
			container:"chart1",
			value:"#sales#",
			label:"#sales#",
			width:30,
			xAxis:{
				start:1,
				end:5,
				step:1,
				title:"Sales per year",
				lines: true
			},
			yAxis:{
				title:"Year",
				template:"#year#"
			},
		gradient:true,
		border:false,
		color: "#6148ff"
	})
	barChart.addSeries({
	    value:"#sales1#",
		color:"#FFFF00",
		label:"#sales1#"
	});
	barChart.addSeries({
	    value:"#sales2#",
		color:"#66ffcc",
		label:"#sales2#"
	});
	barChart.parse(data1,"json");
	}
		</script>
</head>
<body >
	<h1>Main Page</h1>
 <td><div id="chart1" style="width:350px;height:200px;border:1px solid #A4BED4;"></div></td>
 
</body>
</html>