chart.js 简单使用

Posted on Posted in js

这里说的是 1.1.1 版本 中文文档

Chart.min  Chart

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Index</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.1.1/Chart.js"></script>
    </head>
    <body>
        <canvas id="myChart" width="400" height="400"></canvas> 
        <script>
        var ctx = document.getElementById("myChart").getContext('2d');
        var pieData = [
             {
                 value: 30,
                 color:"#F38630",
                 label:"aaaa" // pie 图显示文字
             },
             {
                 value : 50,
                 color : "#E0E4CC"
             },
             {
                 value : 100,
                 color : "#69D2E7"
             }           
             ];
        var myPie = new Chart(ctx).Pie(pieData);
        </script>
        </script>
    </body>
</html>
» 转载请注明来源:若我若鱼 » chart.js 简单使用

Leave a Reply

Your email address will not be published. Required fields are marked *

one × one =