<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Horizontal 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", year:"2000" }, { sales:"3.8", year:"2001" }, { sales:"3.4", year:"2002" }, { sales:"4.1", year:"2003" }, { sales:"4.3", year:"2004" }, { sales:"9.9", year:"2005" }, { sales:"7.4", year:"2006" }, { sales:"9.0", year:"2007" }, { sales:"7.3", year:"2008" }, { sales:"4.8", year:"2009" } ]; window.onload = function(){ var barChart = new dhtmlXChart({ view:"barH", container:"chart_container", value:"#sales#", width:30, label: "#sales#", gradient:function(gradient){ gradient.addColorStop(1.0,"#FF0000"); gradient.addColorStop(0.3,"#FFFF00"); gradient.addColorStop(0.0,"#00FF22"); }, xAxis:{ title:"Sales per year", lines: true }, yAxis:{ title:"Year", template:"#year#" }, legend:{ values:[{text:"Horizontal Bar",color:"#ffffff"}], valign:"top", align:"middle" } }) barChart.parse(data,"json"); } </script> </head> <body > <h1>Horizontal Bar</h1> <div id="chart_container" style="width:500px;height:300px;;border:1px solid #A4BED4;"></div> </body> </html>