-1
chartjを使ってグラフをpugテンプレートでレンダリングしようとしていますが、何らかの理由でそれが機能していない場合、誰かが間違っているのを見ることができますか? pugファイルはうまくロードされますが、そこにはグラフはありません。Chartjsの図表がpugのテンプレートでレンダリングされていない
div(class="main container-fluid text-center")
div(class="choices")
h2
p I'm voting for:
select(class="form-control")
option 1
option 2
option 3
option 4
option 5
div(class="chart")
canvas(id="chartPic" width="400" height="400")
script(src="chart.js")
script.
-window.onload(
-var ctx = document.getElementById("chartPic").getContext('2d');
-var chart = new Chart(ctx, {
-type: 'pie',
-data: {
-labels: ["red", "green", "blue"],
-datasets: [{
-label: 'Number of votes',
-data: [1, 1, 1],
-backgroundColor: ['red', 'green', 'blue'],
-borderColor: ['green', 'blue', 'red'],
-borderWidth: 1
}],
},
-options: {
-title: {
-display: true,
-text: "chart",
},
-legend: {
-position: 'bottom'
},
}
});
);
はありがとうを見て!まだレンダリングされていませんが、エラーは表示されませんが、表示されません。 – Keli
hmm ..おそらくテンプレートで何かが間違っているのですが、 –
ページの最初の部分はレンダリングされていません。それはレンダリングされていない唯一のグラフなので、テンプレートは大丈夫ですが、私はチャートに何か間違っていると思います。私は間違っている可能性があります.. – Keli