DHTMLX Docs & Samples Explorer

Scale

Default Custom scales
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>
<style>
.scale{
    font-size: 11px
}
</style>
<script>
window.onload = function() {
    var chart1 = new dhtmlXChart({
        view: "area",
        container: "chart1",
        value: "#sales#",
        alpha: 0.8,
        color: "#36abee",
        xAxis: {
            template: "'#year#";
        },
        yAxis: {}
    });
    chart1.parse(dataset, "json");
    var chart2 = new dhtmlXChart({
        view: "area",
        container: "chart2",
        color: "#58dccd",
        alpha: 0.8,
        value: "#sales#",
        tooltip: {
            template: "#sales#";
        },
        xAxis: {
            template: "<span class='scale'>'#year#</span>",
            title: "Year";
        },
        yAxis: {
            start: 0,
            step: 10,
            end: 100,
            template: function(value) {
                return "<span class='scale'>" + (value % 20 ? "": value) + "</span>";
            },
            title: "Sales";
        }
    });
    chart2.parse(dataset, "json");
}
</script> <table> <tr> <td>Default</td> <td>Custom scales</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>