0
我在我的网站上使用了一个甜甜圈图表插件。它工作正常,但我想在不同的数据在同一页上的多个图表。请参阅下面的代码。想要在同一页上使用不同数据的多个图表
这就是图我使用
<canvas id="chart-area1" width="200" height="200" style="width:150px !important; height:150px !important;"/></canvas>
脚本是在这里
<script src="http://www.chartjs.org/assets/Chart.min.js"></script>
<script>
var doughnutData = [
{
value: 45,
color:"#17CB8A",
highlight: "#17CB8C",
label: "Strating"
},
{
value: 12,
color: "#FF003C",
highlight: "#FF003A",
label: "Warning"
},
{
value: 7,
color: "#fb6800",
highlight: "#fb6801",
label: "Past Due"
},
{
value: 9,
color: "#88c100",
highlight: "#88c102",
label: "In Progress"
},
];
window.onload = function(){
var ctx = document.getElementById("chart-area1").getContext("2d");
window.myDoughnut = new Chart(ctx).Doughnut(doughnutData, {responsive : true});
};
</script>
我怎样才能复制此图用不同的属性?
请添加到您正在使用 – MazzCris
HTTP插件的引用://www.chartjs .org/assets/Chart.min.js –