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

Custom ChartPie

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



1 Reply

AT Anandaraj T Syncfusion Team June 30, 2014 09:22 AM UTC

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

Loader.
Up arrow icon