sql - Chartkick gem, limit group in pie chart and multiple series -


i have small problem grouped records. chart code:

<%= pie_chart countchatline.group(:channel).count %> 

the problem is, have more few :channels in database, , chart looks this: enter image description here

can somehow take n top :channels , sum rest of others or something? or add others every :channel has less n%?

the chartkick gem (which started using), chart whatever data provide it. it's data provide looks like.

yes, can absolutely reduce number of slices in pie aggregating them, however, need yourself.

you can write method in model summarize , call such:

<%= pie_chart countchatline.summarized_channel_info %> 

method in countchatline model:

def self.summarized_channel_info    {code info , convert format want} end 

hope helps. that's did.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -