Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

Chart in the center of a Doughnut

Open fitimsijarinaa opened this issue 3 years ago • 2 comments

Feature Proposal

It would be nice if in the center of a Doughnut Chart we could add an additional chart as well. In my example in the screenshot you can see what I mean exactly.

image

Possible Implementation

No response

fitimsijarinaa avatar Jan 20 '22 11:01 fitimsijarinaa

I don't think this is something the majority of users will benefit. So it is better to implement this exernally. You can take 2 approaches to achieve what you want:

  • Place another smaller canvas over the doughnut in the center and use that to make another chart with chart.js itself.
  • Write a custom plugin that draws the chart itself on the same canvas as the doughnut is on

LeeLenaleee avatar Jan 20 '22 12:01 LeeLenaleee

It almost works actually: https://codepen.io/kurkle/pen/ZEXNgJW

Just the dougnut controller expects all datasets to be dougnuts, and tries to call _getRotation from every controller, which fails.

kurkle avatar Jan 20 '22 13:01 kurkle