Rails: Remove white border from Pie Chart using Chartkick Gem

允我心安 提交于 2019-12-24 14:27:42

问题


Is there a way to remove the white border from the pie chart slices by adding an option to the library?

I've got a snippet of the code I used to create this chart.

<%= pie_chart monthly(current_user.events), colors: colors_group, width: "200px", height: "200px", library:{animation:{easing: 'easeOutQuad'}} %>

Thank you in advance!


回答1:


Try setting the borderWidth option to 0:

<%= pie_chart monthly(current_user.events), colors: colors_group, width: "200px", height: "200px", library: {animation: {easing: 'easeOutQuad'}, elements: {arc: {borderWidth: 0}}} %>

You can find more options for Chart.js element configuration on their docs page.

Hope this helps!



来源:https://stackoverflow.com/questions/47916211/rails-remove-white-border-from-pie-chart-using-chartkick-gem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!