我尝试用chartnew.js创建一个图表但是我无法从数组加载我的第二个数据,这是我的java脚本
<script type="text/javascript">
var newopts = {
legend: true,
inGraphDataShow: false,
}
var cobaisiprice = [];
var cobaisiqty = [];
var cobaisitoko = [];
@foreach (var label in Model)
{
<text>
cobaisiprice.push('@label.Total_Price');
cobaisiqty.push('@label.Total_Qty');
cobaisitoko.push('@label.Store');
</text>
}
var data = {
labels: cobaisitoko,
datasets: [
{
title: "Price",
fillColor: "rgba(220,220,220,0.5)",
strokeColor: "rgba(220,220,220,1)",
pointColor: "rgba(220,220,220,1)",
pointstrokeColor: "yellow",
data: cobaisiprice,
},
{
title: "Qty",
fillColor: "rgba(151,187,205,0.5)",
strokeColor: "rgba(151,187,205,1)",
pointColor: "green",
pointstrokeColor: "yellow",
data: cobaisiqty,
}
]
};
window.onload = function () {
var myStackedBar = new Chart(document.getElementById("barPrice").getContext("2d")).Bar(data, newopts);
}
</script>
&#13;
请帮助我,为什么我的第二个数据(cobaisiqty)不会在chartnewjs中显示任何内容,它只显示来自cobaisiprice的数据,当我使用像[10,20,30,40,50]这样的数组数据进行测试时它的工作,谢谢你的帮助