我想創建堆疊的條形圖,但我不知道如何做到這一點 我不知道如何在json中放置值 我有Json數據如下:如何從chart.js中的JSON創建堆疊的條形圖
var setdata = [{
"data": [{
"month" : "January",
"name" : "Alex",
"count" : 10
}]
},
{
"data": [{
"month" : "February",
"name" : "Alex",
"count" : 20
},
{
"data": [{
"month" : "February",
"name" : "John",
"count" : 30
},
{
"data": [{
"month" : "February",
"name" : "Mark",
"count" : 40
}]
},
{
"data": [{
"month" : "March",
"name" : "Alex",
"count" : 10
},
{
"month" : "March",
"name" : "John",
"count" : 20
}]
}
]
我要創建堆疊條形圖爲:
| _
| | | Mark
| |_|
| | | _
| | | John | |
| |_| | | John
| | | |_|
| _ | | | |
| | |Alex | | Alex | | Alex
|_|_|___________|_|__________________|_|_______
January February March
Months
幫助我,請。 謝謝。 bar chart in chart.js
請參閱本文檔http://www.chartjs.org/docs/latest/和創建數據集的每提到 –
您發佈的鏈接描述的步驟,該怎麼辦呢? –
如何克里特數據集作爲http://www.chartjs.org/docs/latest/。我不知道該怎麼辦。 – jane