Selvam84 Posted June 15, 2009 Report Share Posted June 15, 2009 Hi <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> I am going to add customized legent by using the following code CustomLegendItem c = new CustomLegendItem(); c.Text = "NA"; c.Picture = icon; c.MarkerShape = MarkerShape.Picture; c.Color = Color.Orange; ChrPieChart.LegendBox.CustomItems.Add©; But both default and customized legends are appearing, how do I hide default legend Please help Quote Link to comment Share on other sites More sharing options...
AndreG Posted June 15, 2009 Report Share Posted June 15, 2009 Here is what you are missing. chart1.LegendBox.ItemAttributes[chart1.Series].Visible = false; Quote Link to comment Share on other sites More sharing options...
Selvam84 Posted June 16, 2009 Author Report Share Posted June 16, 2009 Thanks for your reply but i am still not able to hide the default legend box of the pie chart, I am using the below code, and am having two items in the legend box ChrPieChart.LegendBox.ItemAttributes[ChrPieChart.Series].Visible = false; CustomLegendItem c = new CustomLegendItem(); c.Text = l_LabelName + " " + l_Labelvalue + "%"; c.Picture = icon; c.MarkerShape = MarkerShape.Picture; c.Color = Color.Orange; ChrPieChart.LegendBox.CustomItems.Add©; i even tried using ChrPieChart.LegendBox.ItemAttributes[ChrPieChart.Series,0].Visible = false; ChrPieChart.LegendBox.ItemAttributes[ChrPieChart.Series,1].Visible = false; and i am using the above code inside for loop like for loop { ChrPieChart.LegendBox.ItemAttributes[ChrPieChart.Series].Visible = false; CustomLegendItem c = new CustomLegendItem(); c.Text = l_LabelName + " " + l_Labelvalue + "%"; c.Picture = icon; c.MarkerShape = MarkerShape.Picture; c.Color = Color.Orange; ChrPieChart.LegendBox.CustomItems.Add©; } Quote Link to comment Share on other sites More sharing options...
Selvam84 Posted June 16, 2009 Author Report Share Posted June 16, 2009 adding to the above post, i also noticed that your solution Chart.LegendBox.ItemAttributes[Chart.Series].Visible = false; works for bar chart but not for pie chart Quote Link to comment Share on other sites More sharing options...
AndreG Posted June 16, 2009 Report Share Posted June 16, 2009 Unlike other charts, the pie chart does not display one legend item per series. Since each slice on a pie represents a point, it makes more sense to display one item per point. Try the following. chart1.LegendBox.ItemAttributes[chart1.AxisX].Visible = false; Quote Link to comment Share on other sites More sharing options...
Selvam84 Posted June 16, 2009 Author Report Share Posted June 16, 2009 Thanks a lot it works Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.