Jump to content
Software FX Community

LegendBox ItemAttributes Inverted not working for single series Gantt with MultipleColors


jch111

Recommended Posts

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;

Link to comment
Share on other sites

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 (SeriesAttributes
series in chart1.Series)


{


 
allSeries.Add(series);


}


 


//Iterate from all series and invert the current order


foreach (SeriesAttributes
series in allSeries)


{


 
series.BringToFront();


}


 


I hope it
helps.


 


-- Pipon

post-7134-13922412916222_thumb.gif

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...