DHTMLX Docs & Samples Explorer

Example (Spline)

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>Spline</title>
	<script src="../../codebase/dhtmlxchart.js" type="text/javascript"></script>
	<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxchart.css">
        <script>
        var data = [
		{ sales:"5.0",sales1:"3.4",sales2:"2.1", year:"2000" },
		{ sales:"2.8",sales1:"4.8",sales2:"0.3", year:"2001" },
		{ sales:"1.1",sales1:"4.4",sales2:"2.9", year:"2002" },
		{ sales:"4.4",sales1:"5.5",sales2:"2.6", year:"2003" },
		{ sales:"2.6",sales1:"6.0",sales2:"1.4", year:"2004" },
		{ sales:"4.1",sales1:"5.7",sales2:"1.1", year:"2005" }		 
	]
	window.onload = function(){
	    var splineChart =  new dhtmlXChart({
		view:"spline",
		container:"chart_container",
	        value:"#sales#",
		item:{
			borderColor: "#5104ff",
			color: "#ffffff"
            },
            line:{
            color:"#6148ff",
            width:3
            },
            xAxis:{
		   title:"Year",
		   template:"#year#"
	    },
	    yAxis:{
		   title:"Sales per year"
	    },
	    legend:{
		   values:[{text:"Spline",color:"#ffffff"}],
	           valign:"top",
		   align:"middle"
	    }
	 })
	 splineChart.addSeries({
		value:"#sales1#",
		color:"#45abf5"
	 });
	 splineChart.addSeries({
		value:"#sales2#",
		color:"#3590d0"
	 });
 
	 splineChart.parse(data,"json");
	}
	</script>
</head>
<body >
	<h1>Spline</h1>
 
	<div id="chart_container" style="width:450px;height:300px;;border:1px solid #A4BED4;"></div>
</body>
</html>