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

Changing X-axis item labels

1 Answer 273 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Matthew Hile
Top achievements
Rank 1
Matthew Hile asked on 27 Jul 2012, 11:12 AM
Using VS 2010 and Q2 2012 reporting. I have chart (attached) in my report based on a dynamic query. The query returns 4 columns and two rows as shown below

Question           Me Others Norms
Days in 7           4 4       0.00
Drinks per day  8 10         3.80

I would like to change the X-axis item labels from 1 and 2 to "Days in 7" and "Drinks per day". 

Where in the designer can I do this? Do I need to change the way the data is returned from the database?

Thanks, 

Matthew

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 01 Aug 2012, 09:03 AM
Hello Matthew,

When the chart is bound to a datasource declaratively, you cannot affect the series in any way, because they are generated at run time. To change the labels along an Axis you should create the series programmatically:
  • Set AutoScale to false.
  • Add a range of items to the axis.
  • Populate the Items.
Here is a sample markup:

Chart.PlotArea.XAxis.AutoScale = false;
Chart.PlotArea.XAxis.AddRange(1, 2, 1);
Chart.PlotArea.XAxis[0].TextBlock.Text = "Days in 7";
Chart.PlotArea.XAxis[1].TextBlock.Text = "Drinks per day";

All the best,
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
Matthew Hile
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or