Adding label in center of donut chart


Topic: Adding label in center of donut chart

Bartosz Wolas pro premium priority asked 4 years ago

Hi is there a way to add a label in center of the donut chart i tried adding center text like it works in some other canvas based chart libraries but it didin't work

options: { responsive: true, legend: { display: false }}, centerText: { display: true, text: "7" }


Marcin Luczak staff answered 4 years ago

Hi,

There is no possibility to add any text inside the center of the doughnut chart via any chart methods. You can hover try to place your canvas element and your text inside a container and style your text to be positioned 'absolute' and in the center of the doughnut. Please check my snippet: https://mdbootstrap.com/snippets/jquery/marcin-luczak/3015337. It would need some additional styling to be fully responsive on smaller devices.

Keep coding,

Marcin


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: Yes
  • Technology: MDB jQuery
  • MDB Version: 4.19.2
  • Device: PC / Mobile
  • Browser: Chrome
  • OS: Windows10 / Android 11
  • Provided sample code: No
  • Provided link: No
Tags