DHTMLX Docs & Samples Explorer

Scales

Automatic vertical scale Custom vertical scale
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 chart1 = new dhtmlXChart({
        view: "line",
        container: "chart1",
        value: "#sales#",
        tooltip: {
            template: "#sales#";
        },
        preset: "plot",
        yAxis: {},
        xAxis: {
            template: "'#year#";
        }
    });
    chart1.parse(dataset, "json");
    var chart2 = new dhtmlXChart({
        view: "line",
        container: "chart2",
        value: "#sales#",
        tooltip: {
            template: "#sales#";
        },
        preset: "plot",
        xAxis: {
            title: "Years",
            template: "'#year#";
        },
        yAxis: {
            start: 0,
            end: 100,
            step: 10,
            title: "Sales, million";
        }
    });
    chart2.parse(dataset, "json");
}
</script> <table> <tr> <td>Automatic vertical scale</td> <td>Custom vertical scale</td> </tr> <tr> <td><div id="chart1" style="width:400px;height:250px;border:1px solid #A4BED4;"></div></td> <td><div id="chart2" style="width:400px;height:250px;border:1px solid #A4BED4;"></div></td> </tr> </table>