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.
Unfortunately, activation email could not send to your email. Please try again.

Custom ChartPie

Thread ID:

Created:

Updated:

Platform:

Replies:

116908 Jun 29,2014 05:38 AM Jun 30,2014 05:22 AM ASP.NET MVC (Classic) 1
loading
Tags: Chart
Jesus Sanchez
Asked On June 29, 2014 05:38 AM

Hello,
I am using ASP.net MVC Classic fon my graphics, then: mi ChartPie with data:


Now, my ChartPie without data:


How can I customize my graph ChartPie?? ...

I want to remove the description: 'Empty' and put a different one, my description. Too I would like to further this description to use another font and to central it on the page, can you help me???

Thanks



Anandaraj T [Syncfusion]
Replied On June 30, 2014 05:22 AM

Hi Jesus Sanchez,

Thanks for using Syncfusion products.

The text "Empty" will be displayed if chart does not have any legend item. We can customize this text and its font by adding a custom legend item if number of legend item in chart legend is zero.

Please refer the following code snippet to achieve this.
<code>
[CS]
            //Displaying text instead of displaying empty
            if (model.Legend.Items.Length == 0)
            {
                model.Legend.CustomItems = new ChartLegendItem[]{new ChartLegendItem("Custom Text")};
                //Hiding legend item representation icon
                model.Legend.CustomItems[0].RepresentationSize = new Size(0, 0);
                //Setting font for text
                model.Legend.CustomItems[0].Font = new Font("Segoe UI", 12, FontStyle.Bold);
                //Customizing alignment of legend text
                model.Legend.TextAlignment = StringAlignment.Near;
            }
</code>

We have also created a simple sample based on your requirement and it can be downloaded from the following link.
PieChartMvc.zip

Please let us know if you have any concern.

Regards,
Anand

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.

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.

;