Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Series labels not showing
posted

I have a problem with series labels not showing - it can easily be reproduced. Taking the standard example for column charts:

DataTable dt = new DataTable();
dt.Columns.Add("col1", typeof(string));
dt.Columns.Add("col2", typeof(int));
dt.Columns.Add("col3", typeof(int));
dt.Rows.Add( new object[{"Series1", 10, 20});
dt.Rows.Add( new object[{"Series2", 30, 40});

chart.Data.DataSource = dt;

This will work just fine.

But as soon as one of the column's names gets longer, like "column 2 with a rather long name" the series label is no longer shown. The only way to show the series label in this situation is to manually assign a large extent for the X axis. This is rather disturbing when creating these charts dynamically, or for localized charts.

Is there any other way to ensure the series labels are always shown, even when the item labels' strings are not known during design time, and they could potentially be long?

 

Another question: Is it possible to show series labels in bar charts at all?

 

Thank you,

 

Stefan