I hope I am posting this question on the correct forum but anyway, I'm having some difficulty getting a Legend on a Chart Control to behave in the way I would like it to.
I want the legend to be placed under the chart, and legend items for each series to be added to the legend in the order the series are added to the chart.
Say I have 6 series which are added to the chart in order: A, B, C, D, E, F.
Suppose that the chart area in which the legend is docked is such a size that the legend has 3 columns.
I want the legend to be filled like so:
A B C
D E F
i.e. columns first, then rows.
Frustratingly, this is not the behaviour I am getting.
As I add the first three series all is fine, and I get a legend with 3 columns and 1 row filled like so:
A B C
But when I add a 4th series, instead of getting:
A B C
as one might expect, the legend looks like this:
A C D
Then when I add the next series I get:
A C E
And when I add the final series I get:
A C E
B D F
This is really frustrating me as I have trawled the internet and cannot find any mention of this issue, let alone an answer. Surely wanting the legend to be filled columns first, then rows, would be the most logical way of doing it, so I can't believe that the .NET guys haven't allowed for this possibility.
Anyway, my legend is set with the following properties:
Legend legend = new Legend("Legend1");
legend.LegendItemOrder = LegendItemOrder.ReversedSeriesOrder;
legend.Alignment = StringAlignment.Center;
legend.Docking = Docking.Bottom;
legend.LegendStyle = LegendStyle.Table;
legend.TableStyle = LegendTableStyle.Wide;
legend.IsEquallySpacedItems = true;
legend.AutoFitMinFontSize = 6;
legend.IsTextAutoFit = true;
Can anyone please help me?
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.