我有一些要动态传递到Chart.js库的甜甜圈图的数据,但是我尝试制作它,但是它不起作用。
<script>
var OrganizationsPriceRanges=
@Html.Raw(Json.Encode(ViewBag.OrganizationsPriceRanges));
var PriceRangesList= @Html.Raw(Json.Encode(ViewBag.PriceRangesList));
var doughnutData = [
{
value: OrganizationsPriceRanges,
color:["#F7464A","#FDB45C","#4D5360"],
highlight: "#FF5A5E",
label: PriceRangesList
},
];
var ctx =
document.getElementById("PriceRanges").getContext("2d");
window.myDoughnut = new
Chart(ctx).Doughnut(doughnutData, {responsive : true});
</script>