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

[Solved] Legend based off Data Table Column in Pie Chart

3 Answers 332 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Jeff Lester
Top achievements
Rank 1
Jeff Lester asked on 04 Jan 2008, 03:08 AM
I'm hoping that someone can help me. I have a Pie chart which looks great! only problem is, if I choose the value as the label, Both the legend and the labels on the pie pieces show the same value. If I show the item names as labels, same thing. It seems the legend can only reference the pie series items labels. I need some way for the legend to show the pie series items values while the label on the pie pieces show the item name, or vice-versa, I'm not overly picky on the direction. This is my codebehind now:

    protected void FormatChart2()
    {
        RadChart2.Skin = "Vista";
        RadChart2.IntelligentLabelsEnabled = true;
        RadChart2.Legend.Visible = true;
        RadChart2.Series.Clear();
        ChartSeries series = new ChartSeries();
        series.DataYColumn = "EventCount";
        //series.DataXColumn = "EventTypes";
        series.Name = "Incidents Entered";
        series.DefaultLabelValue = "#%";
        series.DataLabelsColumn = "EventTypes";
        series.Appearance.ShowLabels = true;
        series.Appearance.ShowLabelConnectors = true;
        series.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
        series.Type = ChartSeriesType.Pie;
        RadChart2.Series.Add(series);
        RadChart2.Appearance.ImageQuality = Telerik.Charting.Styles.ImageQuality.AntiAlias;
        RadChart2.ChartTitle.TextBlock.Text = "Incidents By Type for " + txtMonth.Text + "/" + txtYear.Text;
    }

How can I set it so the legend shows 'EventTypes' while thet pie pieces show 'EventCount' or vice-versa. Any help would be greatly appreciated. Thanks!

3 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 04 Jan 2008, 04:58 PM
Hello Jeff Lester,

Please, check the example attached to this form thread. It answers the very same question. Give it a try and let us know if further questions arise.

Greetings,
Ves
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jeff Lester
Top achievements
Rank 1
answered on 07 Jan 2008, 12:45 AM
Hi Ves,

Thanks for the reply. I went to that thread and tried that message but now I'm getting the following error:

Compiler Error Message: CS0123: No overload for 'RadChart2_ItemDataBound' matches delegate 'System.EventHandler'

Any idea why?

Regards,
Jeff
0
Jeff Lester
Top achievements
Rank 1
answered on 07 Jan 2008, 01:15 AM
My apologies, it does work, and exactly as intended. Thanks a bunch!  
Tags
Chart (Obsolete)
Asked by
Jeff Lester
Top achievements
Rank 1
Answers by
Ves
Telerik team
Jeff Lester
Top achievements
Rank 1
Share this question
or