LightningWebChartJS icon indicating copy to clipboard operation
LightningWebChartJS copied to clipboard

Is this possible to configure ChartJS to work like Google Charts to display both absolute values and percentage of total and they display the value outside the pie so that it is more visible?

Open Patlatus opened this issue 1 year ago • 2 comments

I was considering using Google Chart API for a pie chart since they provide an option to display both absolute values and percentage of total and they display the value outside the pie. Is this possible to configure ChartJS to work like Google Charts to display both absolute values and percentage of total and they display the value outside the pie so that it is more visible?

Does it require development or it is possible to achieve with configuration only?

Patlatus avatar Aug 01 '22 20:08 Patlatus

I guess I could try to use tooltip callback to display percentage https://stackoverflow.com/questions/61953064/laravel-how-to-display-both-count-and-percentage-in-chartjs-pie-chart but how to display the value outside of the pie so it becomes visually distinguishable?

Patlatus avatar Aug 01 '22 20:08 Patlatus

Hi @Patlatus !

Yep you nailed it, you will have to calculate them on your own, ChartJs will not does that for you. As explained in the link you found, you'll need to use the tooltip label callback.

We are exposing this callback so you can use LWCC to do that

scolladon avatar Aug 09 '22 12:08 scolladon