Javascript 向图表js饼图添加标签
我正在使用chart.js添加饼图。我可以显示图表,但希望显示标签、百分比和图例 有人知道怎么做吗 下面是我如何生成饼图的:Javascript 向图表js饼图添加标签,javascript,coffeescript,chart.js,Javascript,Coffeescript,Chart.js,我正在使用chart.js添加饼图。我可以显示图表,但希望显示标签、百分比和图例 有人知道怎么做吗 下面是我如何生成饼图的: dashboardRegion: (survey) -> male = 0 female = 0 survey.get('responses').each (response) -> if response.get('completed') if response.get('gender'
dashboardRegion: (survey) ->
male = 0
female = 0
survey.get('responses').each (response) ->
if response.get('completed')
if response.get('gender') == "male"
male += 1
else
female += 1
genderData = [
{
value: male,
color:"#9A3334",
highlight: "#9A3334",
label: "Male",
labelFontFamily : "Arial",
labelFontStyle : "normal",
labelFontSize : 24,
labelFontColor : "#666"
},
{
value: female,
color: "#217C7E",
highlight: "#217C7E",
label: "Female",
labelFontFamily : "Arial",
labelFontStyle : "normal",
labelFontSize : 24,
labelFontColor : "#666"
}
];
添加此项似乎可以实现显示标签的技巧-