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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Center text in the middle of the chart

Thread ID:

Created:

Updated:

Platform:

Replies:

141865 Jan 8,2019 09:30 PM UTC Jan 9,2019 09:33 AM UTC ASP.NET MVC 1
loading
Tags: Chart
Miguel Angel
Asked On January 8, 2019 09:30 PM UTC

Hi my friends

I am trying to put the values ​​of the graph in the center of the Doughnut, in a few words I want to visualize the values ​​of the tooltip in a text in the center of the graph.

I appreciate the help with this topic, if this requirement is possible.

I want some like this:


 thanks for helping.

Kalaimathi Chellaiah [Syncfusion]
Replied On January 9, 2019 09:33 AM UTC

Hi Miguel, 
 
Greetings from Syncfusion. 
 
We have analyzed your requirement with attached screenshot. We can achieve this requirement using  chart annotation feature and PointRegionMouseMove event. Using this event we can get current point values and use this information in annotation which is placed to the center of the donut. 

Code Snippet:  
//Annotation content div 
<div id="watermark" style="display:none"> 
        <span></span><label style=";font-size:30px; position: relative;" id="lblMsg"></label> 
</div> 
<div> 
@(Html.EJ().Chart("container").Annotations(an => 
          { 
              //Used to place the text in center of the chart 
              an.Visible(true).Content("watermark").Region(Syncfusion.JavaScript.DataVisualization.Region.Series).Add(); 
          }) 
) 
</div> 
function pointregionmousemove(args) { 
   var label = document.getElementById('lblMsg'); 
           label.style.color = args.model.series[0].points[args.data.pointData[0].PointIndex].fill; 
           label.innerHTML = args.model.series[0].points[args.data.pointData[0].PointIndex].y + '%' + '<br/>' + ' ' + args.model.series[0].points[args.data.pointData[0].PointIndex].x ; 
          //some code here 
      } 
 
Screenshot: 
 
 

Regards, 
Kalai 
 
 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon