DHTMLX Docs & Samples Explorer

Horizontal Bars

Source
<script src="../../codebase/dhtmlxchart.js" type="text/javascript"></script>
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxchart.css">
<script src="../common/testdata.js"></script>
 
<div id="chartDiv" style="width:400px;height:350px;border:1px solid #A4BED4;margin:20px"></div>
<script>
var barChart1 = new dhtmlXChart({
    view: "barH",
    container: "chartDiv",
    value: "#sales#",
    label: "#sales#",
    color: "#color#",
    barWidth: 30,
    radius: 2,
    tooltip: {
        template: "#sales#";
    },
    yAxis: {
        template: "'#year#";
    },
    xAxis: {
        start: 0,
        end: 100,
        step: 10,
        template: function(obj) {
            return (obj % 20 ? "": obj);
        }
    },
    padding: {
        left: 30;
    }
});
barChart1.parse(dataset_colors, "json");
</script>