DHTMLX Docs & Samples Explorer

Initiazation

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>
<script>
window.onload = function() {
    var barChart1 = new dhtmlXChart({
        view: "bar",
        container: "chart1",
        value: "#sales#",
        label: "'#year#",
        barWidth: 35,
        radius: 0,
        gradient: "rising";
    });
    barChart1.parse(dataset, "json");
    barChart1.attachEvent("onItemClick", function(id) {
        alert(id)
        });
    var barChart2 = new dhtmlXChart({
        view: "bar",
        container: "chart2",
        value: "#sales#",
        label: "'#year#",
        color: "#66ccff",
        gradient: "rising",
        barWidth: 25,
        padding: {
            top: 50,
            bottom: 0,
            right: 50,
            left: 50;
        }
    });
    barChart2.parse(dataset, "json");
}
</script> <table> <tr> <td></td> <td></td> </tr> <tr> <td><div id="chart1" style="width:450px;height:200px;border:1px solid #A4BED4;"></div></td> <td><div id="chart2" style="width:450px;height:200px;border:1px solid #A4BED4;"></div></td> </tr> </table>