jch111 Posted November 20, 2009 Report Share Posted November 20, 2009 Using this code, I am unable to invert the legend box items. I need for the order of items in the legend to agree with the order of the Axis X labels. Any suggestions greatly appreciated! chart1.Data.Series = 1;chart1.Gallery = Gallery.Gantt; chart1.AllSeries.MultipleColors = true; chart1.Data[0, 0] = 2;chart1.Data[0, 1] = 3; chart1.AxisX.Labels[0] = "AAA";chart1.AxisX.Labels[1] = "BBB"; chart1.Width = 800;chart1.Height = 200; chart1.LegendBox.ItemAttributes[chart1.Series].Inverted = true; //doesn't matter whether I use true or false. This has no effectchart1.LegendBox.Visible = true; Quote Link to comment Share on other sites More sharing options...
CarlosAC Posted November 23, 2009 Report Share Posted November 23, 2009 Hi jch111 Instead of changing the Legend Box Items position, please try following code: List<SeriesAttributes>allSeries = new List<SeriesAttributes>(); //Adds all series (in current order) to the auxiliar Collection foreach (SeriesAttributesseries in chart1.Series) { allSeries.Add(series); } //Iterate from all series and invert the current order foreach (SeriesAttributesseries in allSeries) { series.BringToFront(); } I hope ithelps. -- Pipon 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.