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 –