How do I efficiently summarize my data for a ChartJS Doughnut or Pie?

0
I want to build a doughnut / pie / single series chart using ChartJS. This requires me to: 1. Fill in the total value into the Chart object 2. Fill in one value for each slice in the Dataset object It's #2 that I'd like to know about: What is the easy way to get a total value for each of my slices to put into the Dataset? Outside of Mendix I'd do a Count/Group By query. What's the best practice within Mendix? How do I implement this in a Microflow?  
asked
2 answers
0

Rob,

I have an example that is the datasource for a Pie chart.  It produces a pie chart for energy usage for a building.  The pie slices are electricity, gas and oil.  Model Share here:  https://modelshare.mendix.com/models/38a41fb4-f364-42d5-81f6-1061b4104d1c/data-source-total-cost-pie-building

Picture below:

****EDIT******

Rob - here is an example with a dynamic number of pie pieces:

Model share here:  https://modelshare.mendix.com/models/35486b48-2264-4e7a-84e4-529e22220fa2/example-of-chartjs-datasource-microflow-for-a-pie-chart-with-dynamic-number-of-slices

****END OF EDIT******

Hope that helps,

Mike

answered
0

Thanks for this example, but it has one problem: The pie slices are hard-coded. What if I want to summarize open tasks in a process list by owner. It could be any X owners of 500 name users. What then?

answered