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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Caption in Center of Doughnut Chart

Thread ID:

Created:

Updated:

Platform:

Replies:

117792 Dec 15,2014 08:43 PM UTC Dec 16,2014 11:04 AM UTC JavaScript 1
loading
Tags: ejChart
Josh Bowen
Asked On December 15, 2014 08:43 PM UTC

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

Jayavigneshwaran [Syncfusion]
Replied On 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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;