DHTMLX Docs & Samples Explorer

### Styles

Source

    <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 barChart1 = new dhtmlXChart({
            view: "bar",
            alpha: function(data) {
                return data.sales / 10;
            },
            container: "chart1",
            value: "#sales#",
            label: "#sales#",
            color: "#66cc33",
            width: 50,
            tooltip: {
                template: "#sales#";
            },
            xAxis: {
                title: "Sales per year",
                template: "#year#";
            },
            yAxis: {
                start: 0,
                end: 10,
                step: 1,
                title: "Sales,<br/>million";
            }
        });
        barChart1.parse(data, "json");
        var barChart2 = new dhtmlXChart({
            view: "bar",
            container: "chart2",
            value: "#sales#",
            label: "#sales#",
            width: 2,
            border: false,
            tooltip: {
                template: "#sales#";
            },
            xAxis: {
                title: "Years",
                template: "#year#";
            },
            yAxis: {
                start: 0,
                end: 10,
                step: 1,
                title: "Sales,<br/>million";
            }
        });
        barChart2.parse(data, "json");

        var barChart3 = new dhtmlXChart({
            view: "bar",
            container: "chart3",
            value: "#sales#",
            label: "#sales#",
            width: 35,
            border: false,
            gradient: true,
            xAxis: {
                title: "Sales per year",
                template: "#year#";
            },
            yAxis: {
                start: 0,
                end: 10,
                step: 1,
                title: "Sales,<br/>million";
            }
        });
        barChart3.parse(data, "json");
        var barChart4 = new dhtmlXChart({
            view: "bar",
            alpha: function(data) {
                return data.sales / 10;
            },
            container: "chart4",
            value: "#sales#",
            label: "#sales#",
            color: "#66cc33",
            width: 50,
            gradient: function(gradient) {
                gradient.addColorStop(1.0, "#FF0000");
                gradient.addColorStop(0.2, "#FFFF00");
                gradient.addColorStop(0.0, "#00FF22");
            },
            tooltip: {
                template: "#sales#";
            },
            xAxis: {
                title: "Sales per year",
                template: "#year#";
            },
            yAxis: {
                start: 0,
                end: 10,
                step: 1,
                title: "Sales,<br/>million";
            }
        });
        barChart4.parse(data, "json");

        var barChart5 = new dhtmlXChart({
            view: "bar",
            container: "chart5",
            value: "#sales#",
            label: "#sales#",
            width: 35,
            tooltip: {
                template: "#sales#";
            },
            xAxis: {
                title: "Sales per year",
                template: "#year#";
            },
            yAxis: {
                start: 0,
                end: 10,
                step: 1,
                title: "Sales,<br/>million";
            }
        });
        barChart5.parse(data, "json");
        var barChart6 = new dhtmlXChart({
            view: "bar",
            alpha: function(data) {
                return data.sales / 10;
            },
            container: "chart6",
            value: "#sales#",
            label: "#sales#",
            color: "#66cc33",
            border: false,
            width: 30,
            tooltip: {
                template: "#sales#";
            },
            xAxis: {
                title: "Sales per year",
                template: "#year#";
            },
            radius: 0,
            yAxis: {
                start: 0,
                end: 10,
                step: 1,
                title: "Sales,<br/>million";
            }
        });
        barChart6.parse(data, "json");
    }</script>

    <table>
        <tr>
            <td><div id="chart1" style="width:450px;height:300px;border:1px solid #A4BED4;"></div></td>
            <td><div id="chart2" style="width:450px;height:300px;border:1px solid #A4BED4;"></div></td>
            <td><div id="chart3" style="width:450px;height:300px;border:1px solid #A4BED4;"></div></td>
        </tr>
        <tr>

        </tr>
        <tr>
            <td><div id="chart4" style="width:450px;height:300px;border:1px solid #A4BED4;"></div></td>
            <td><div id="chart5" style="width:450px;height:300px;border:1px solid #A4BED4;"></div></td>
            <td><div id="chart6" style="width:450px;height:300px;border:1px solid #A4BED4;"></div></td>
        </tr>
    </table>