Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
150
igDoughnutChart add text/label to centre
posted

Hi,


Is it possible to add text/label to the centre of the igDoughnutChart? Like the number 13 below:

Thanks,

Euan.

Parents
  • 2525
    posted

    Hello Euan,


    This behavior is not supported by our tools unfortunately. But there are ways in which you can achieve this. Since the igDoughnutChart is drawn utilizing the canvas element, you can get the canvas element utilizing jQuery’s get method. Here’s a link to jQuery’s documentation: https://api.jquery.com/jquery.get/ Note that there are other ways to get the element; this is just one of many options.


    Afterwards, you can use the canvas element’s getContext() method to get the canvas’ drawing context. Now you would need to include the appropriate logic to draw onto the canvas. If your label is strictly text, here’s a link that can help you out: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_text


    If you are not familiar with the canvas element, I recommend giving this a read: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API

Reply Children
No Data