亲爱的,我是Rails开发的新手,现在尝试使用Chartkick来显示饼图。
我通过在application.js中添加require highchart来使用Highchart。除数据标签外,一切顺利。我试图隐藏它们,但它们总是在那里。
原始代码如下:
new Chartkick.PieChart("changepie", {"WithoutChange":<%=@count_noChange%>,"WithChange":<%=@count_change%>}, {"colors":["#FF9900","#3366CC"]});
正如本post所述,我添加了
new Chartkick.PieChart("changepie", {"WithoutChange":<%=@count_noChange%>,"WithChange":<%=@count_change%>}, {"colors":["#FF9900","#3366CC"]}, {"library": { "plotOptions": { "pie": { "allowPointSelect": true, "cursor": "pointer", "dataLabels": { "enabled": false}, "showInLegend": true}}}} );
但数据标签仍然存在? 在创建饼图以隐藏数据标签时,您能否建议如何指定选项?
谢谢!
答案 0 :(得分:0)
pie_chart data, library: {plotOptions: { pie: { dataLabels: { enabled: false }}}}