Rails: legend of pie legends at Chartkicks

In highcharts, to show the percentage along with pie_charts, the legend can be configured as follows:

legend: {labelFormat: '{name} : {y} ({percentage}%)'}

But in chartkicksI can not find how to do this?

+4
source share
1 answer

If you look at the documentation listed on the ChartKick Gem homepage , it says:

You can pass options directly to the charting library with:

<%= line_chart data, library: {backgroundColor: "#eee"} %>

So in your scenario you should try something like:

<%= pie_chart data, library: {legend: {labelFormat: '{name} : {y} ({percentage}%)'}} %>
+3
source

Source: https://habr.com/ru/post/1630018/


All Articles