This is a migrated thread and some comments may be shown as answers.

PieChart how to hide Legend area

3 Answers 256 Views
Chart
This is a migrated thread and some comments may be shown as answers.
qwer
Top achievements
Rank 1
qwer asked on 11 Jan 2011, 03:06 AM
Hi all,

I set LegendDisplayMode="None", but I can still see the Legend Colum. (above pie chart in my uploaded picture)
<telerik:PieSeriesDefinition ShowItemToolTips="True" LegendDisplayMode="None">
I want to hide the whole Legend Area as I want to show as (below pie chart in my uploaded picture).
And I don't want to show ItemLabelFormat which is 0.00%.

Please advise for my requirements.

I'm using MVVM approach, so no code behind file.

Thanks in advance.
qwer

3 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 13 Jan 2011, 01:46 PM
Hi,

To make the chart Legend invisible set the Visibility property to Collapsed:
radChart.DefaultView.ChartLegend.Visibility = System.Windows.Visibility.Collapsed;
To disable the Percentage appearance of the pie labels just remove the ItemLabelFormat code line.

I hope this helps.

Kind regards,
Evgenia
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
qwer
Top achievements
Rank 1
answered on 14 Jan 2011, 02:23 AM
Thanks for reply
and invisible for Legend is working.

For ItemLabelFormat, I want to show ItemLabel % when value is greater than 0, I don't want to show ItemLabel% when which is equal to 0%. Any Advise?

thanks
0
Evgenia
Telerik team
answered on 18 Jan 2011, 09:06 AM
Hello,

To be able to show Percentage format for those pie slices that are not 0 you can use this approach:
Subscribe to ItemDataBound event of the chart. Then set Percentage LabelFormat property if DataPoint's YValue is not 0 like this:
private void radChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)
        {
            if (e.DataPoint.YValue != 0)
            {
                e.DataPoint.LabelFormat = "#%{p}";
            }
        }

Kind regards,
Evgenia
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
Chart
Asked by
qwer
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
qwer
Top achievements
Rank 1
Share this question
or