This is a migrated thread and some comments may be shown as answers.

Axis Labels as Int

3 Answers 105 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kellen
Top achievements
Rank 1
Kellen asked on 27 Apr 2011, 06:27 PM
I've got an interesting problem where I cannot get my Xaxis labels to display as a string! The values are usually numeric but are also occasionally alpha/numeric. I've searched and searched and cannot figure out why it would be behaving this way. I've got a bar graph and, for example, if the label data is "X1500" for a given column it is displaying as "0". It looks to me like reporting is trying to parse it as an int...? Also, if the value is supposed to be "00018" the graph is displaying that value as simply "18" (dropping the leading zeros)...
 
Also, I'm using the exact same field as label text in another part of my report and it is displaying properly there.

HELP! Thanks.

3 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 29 Apr 2011, 06:23 AM
Hello Kellen,

I am afraid, there is a bug in the chart item for scenarios like this. The workaround here would be to populate the ChartSeries with their ChartSeriesItems manually and do the same for the XAxis. Here is an example for data coming from a DataTable:

RadChart1.PlotArea.XAxis.AutoScale = false;
RadChart1.PlotArea.XAxis.Items.Clear();
 
for (int i = 0; i < tbl.Rows.Count; i++)
{
     ChartSeriesItem item = new ChartSeriesItem((int)tbl.Rows[i]["Value"]);
     RadChart1.Series[0].Items.Add(item);
     ChartAxisItem axisItem = new ChartAxisItem(tbl.Rows[i]["Name"].ToString());
     RadChart1.PlotArea.XAxis.Items.Add(axisItem);
 }


Kind regards,
Ves
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kellen
Top achievements
Rank 1
answered on 29 Apr 2011, 04:28 PM
Thanks. Another work around I found was to add a character like an * or | before the label data... of course then I have a funny out-of-place character before my labels... but that's acceptable for what I'm doing. Thanks again.
0
Steve
Telerik team
answered on 25 Sep 2012, 11:08 AM
Hi Kellen,

Improving on your workaround is adding a Zero Width Space character instead of a bogus character before the label data.

Kind regards,
Steve
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Kellen
Top achievements
Rank 1
Answers by
Ves
Telerik team
Kellen
Top achievements
Rank 1
Steve
Telerik team
Share this question
or