We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Caption in Center of Doughnut Chart

Is it possible to put the caption of the doughnut chart in the center of the chart? 

1 Reply

JA Jayavigneshwaran Syncfusion Team replied to Josh Bowen December 16, 2014 11:04 AM UTC

Is it possible to put the caption of the doughnut chart in the center of the chart? 

Hi Josh,

Thanks for using Syncfusion product.

We have analyzed this.

This cannot be done directly, but can be achieved as an work around.

The below code snippet shows a method which is triggered on animationComplete of chart.

[JS]

function complete(sender){  // triggered on animation complete

if($("#template1").length==0){

var template = $("<span>Project Cost Breakdown</span>").attr('id', "template1"); //create span tag

$(template).appendTo("#chartContainer_container"); //append it to container

}

var template = "#template1";

var textWidth = $(template).width(); // get span width

var textHeight = $(template).height(); //get span height

 

 $(template).css({"position": "absolute",                     // apply css

"marginLeft": sender.model.m_AreaBounds.Width/2 - textWidth/4, 

 "marginTop": sender.model.m_AreaBounds.Height/2 + textHeight/2,

"display" : "block"

});

 

}

 

We have also prepared a sample to illustrate this.

Link: http://www.syncfusion.com/downloads/support/directtrac/131552/doughnut613125429.zip

 

Please let us know if you have any concern.


Thanks,

Jayavigneshwaran


Loader.
Live Chat Icon For mobile
Up arrow icon