3

Dears, I am new to Rails development, and now try to use Chartkick to show a pie chart.

I uses Highchart by adding require highchart in application.js. Everything goes well except the data labels. I try to hide them but they are always there.

The original code is like:

new Chartkick.PieChart("changepie", {"WithoutChange":<%=@count_noChange%>,"WithChange":<%=@count_change%>}, {"colors":["#FF9900","#3366CC"]});

As answered in this post, I added

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}}}} );

But the data label is still there? Could you please advise how to specify the options when creating a pie chart to hide data label?

Thanks!

Community
  • 1
  • 1
JohnZhang
  • 191
  • 5
  • 15

1 Answers1

1
pie_chart data, library: {plotOptions: { pie: { dataLabels: { enabled: false }}}}
Jose Hidalgo
  • 421
  • 4
  • 8