Hi,
I am trying to populate a bar chart Dynamically and have been successful so far. My only problem is that I'm not able to widen the lable's of the XAixs.
I have tried the following code but without any success. (catList is the string array which contains the xaxis items, chart1 is the instance of the chart control )
ChartAxisItem[] items = new ChartAxisItem[catList.Length];
ChartAxisItem itm;
chart1.PlotArea.XAxis.Appearance.TextAppearance.MaxLength = 100;
for (int i = 0; i < catList.Length; i++)
{
itm = new ChartAxisItem(catList[i].Length > 20 ? catList[i].Substring(0, 20) : catList[i]);
itm.Appearance.RotationAngle = 315f;
itm.TextBlock.Appearance.MaxLength = 150;
itm.TextBlock.Appearance.Dimensions.AutoSize = false;
//itm.TextBlock.Appearance.Dimensions.Height = Telerik.Reporting.Charting.Styles.Unit.Pixel(25f);
itm.TextBlock.Appearance.Dimensions.Width = Telerik.Reporting.Charting.Styles.Unit.Pixel(200f);
chart1.PlotArea.XAxis.Items.Add(itm);
}
I have also attached a screen print of the chart.
Thanks
Nishan
I am trying to populate a bar chart Dynamically and have been successful so far. My only problem is that I'm not able to widen the lable's of the XAixs.
I have tried the following code but without any success. (catList is the string array which contains the xaxis items, chart1 is the instance of the chart control )
ChartAxisItem[] items = new ChartAxisItem[catList.Length];
ChartAxisItem itm;
chart1.PlotArea.XAxis.Appearance.TextAppearance.MaxLength = 100;
for (int i = 0; i < catList.Length; i++)
{
itm = new ChartAxisItem(catList[i].Length > 20 ? catList[i].Substring(0, 20) : catList[i]);
itm.Appearance.RotationAngle = 315f;
itm.TextBlock.Appearance.MaxLength = 150;
itm.TextBlock.Appearance.Dimensions.AutoSize = false;
//itm.TextBlock.Appearance.Dimensions.Height = Telerik.Reporting.Charting.Styles.Unit.Pixel(25f);
itm.TextBlock.Appearance.Dimensions.Width = Telerik.Reporting.Charting.Styles.Unit.Pixel(200f);
chart1.PlotArea.XAxis.Items.Add(itm);
}
I have also attached a screen print of the chart.
Thanks
Nishan