网页,html5,canvas,js 动态绘制柱形图

网页,html5,canvas,js 动态绘制柱形图_第1张图片

<!DOCTYPE html>
    <head><title>chart demo</title>
        <style>
            #chartContainer{
                border:solid 1px #999;
                
            }
        </style>
        <script src="H5Draw.js"></script>
        <script src="h5Charts.js"></script>
        <script>
            function   zxt(){
            var chart = new h5Charts.SerialChart();
            chart.dataProvider = [{age:"18",amount:0.1},{age:"38",amount:0.3},


{age:"8",amount:0.4},{age:"29",amount:0.2}];
            chart.categoryField = "age";
            chart.valueField = "amount";
            chart.type = "column";
            chart.columnWidth = 55;
            chart.colors = ["#f00","#0f0","#0ff","#00f"];
            chart.addTo("chartContainer");
            };
        </script>
    </head>
    <body>
        <canvas id="chartContainer" width="1000" height="400">
             browser doesn't support html5
        </canvas>
        <script>zxt()</script>
    </body>
</html>



本例需要两个js文件,可以去http://download.csdn.net/detail/u013378306/8756825下载

你可能感兴趣的:(网页,html5,canvas,js 动态绘制柱形图)