I have this chart with some series in legend and this chart is docking fill in panel. The legend has these properties:
chart1.Legends.Add(seriesName);
chart1.Legends[0].Docking = Docking.Bottom;
chart1.Legends[0].TableStyle = LegendTableStyle.Wide;
chart1.Legends[0].BorderColor = Color.CornflowerBlue;
chart1.Legends[0].BorderDashStyle = ChartDashStyle.Dash;
chart1.Legends[0].BorderWidth = 1;
Chart with only a few series:
With even more series but the same interval date I have this result:
The issue is not the scale of the data but the reduced size of the ChartArea itself.. - How can I fix this?
The reason is in this line:
chart1.Legends.Add(seriesName);
What it does is adding one totally empty Legend
, most likely for each of the Series
you add. It is placed at the default position, that is to the right. And if you get enough of them they push the ChartArea
back to the left..
Simply remove the line, as all Series
get added to the default Legend
anyway. It is only that default Legend
your next lines style and position docked to the bottom.
To demostrate the effect you can add a LegendItem
to each:
Legend l = chart1.Legends.Add(chart1.Legends.Count + ""));
l.CustomItems.Add(Color.HotPink, chart1.Legends.Count + " *");
Result:
As you can see even very few extra Legends
push the ChartArea
way to the left. Yours are empty, so they don't take as musch room, but still..