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

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

<!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下载

上一篇:ZeroMQ接口函数之 :zmq_strerror - 获取ZMQ错误描述字符串


下一篇:iOS网络编程之三——NSURLConnection的简单使用