我尝试使用Node.js,mongoose和Handlebars在Chart.Js中显示动态数据,我也安装了chartjs-node。问题是我不知道该怎么做。
var schema = new Schema({
author: String,
post: String,
choice: String
}, {
timestamps: true
});
Chart.js的功能示例(public / javascripts / style.js)
new Chart($("#answerChart"), {
type: 'pie',
data: {
labels: ["Africa", "Asia", "Europe", "Latin America", "North America"],
datasets: [{
label: "Population (millions)",
backgroundColor: ["#3e95cd", "#8e5ea2","#3cba9f","#e8c3b9","#c45850"],
data: [2478,5267,734,784,433]
}]
},
options: {
title: {
display: true,
text: 'Predicted world population (millions) in 2050'
}
}
});
我需要在Handlebars文件中显示图表