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

Problem with x-axis when exporting to PDF

3 Answers 67 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rich
Top achievements
Rank 1
Rich asked on 27 Jun 2011, 09:02 PM
I have a report that uses a line chart to show a trend of data across a date range. Code has been put in place to compensate for how the x-axis labels are rendered so that a large date range is readable. On the NeedDataSource event for the chart, I fetch the data then use the following code to adjust the x-axis label.

int labelStep = (dataList.Count / 10);
 
chartTrendByDay.DataSource = dataList;
if (labelStep == 0)
    labelStep = 1;
chartTrendByDay.PlotArea.XAxis.LabelStep = labelStep;

When viewing the report in the ReportViewer, the above code results from 1..10 points on the x-axis. The problem is, when exporting to PDF I end up with 1 point for each day (i.e. a report for the trend across the year results in 365 data points), which is unreadable in most circumstances. See attached for the viewer-vs-PDF screenshots.

Question: How to I fix the export to PDF so that the x-axis is readable?

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 30 Jun 2011, 09:58 PM
Hello Rich,

As you probably know every time the report is previewed, paged or exported through the viewer it is processed and rendered from scratch. This means that the code in the chart NeedDataSource event would be executed once again and the axis labels would be re-added. You need to clear the Axis prior every execution i.e. chartTrendByDay.PlotArea.XAxis.Clear();

Greetings,
Steve
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
Rich
Top achievements
Rank 1
answered on 14 Jul 2011, 12:34 AM
I added the call to Clear() on the YAxis to the NeedDataSource event. It had no effect. Any other ideas?
0
Steve
Telerik team
answered on 14 Jul 2011, 09:59 AM
Hi Rich,

We would need the whole code in the NeedDataSource event or best a sample runnable report that exhibits the problem. You can open a support ticket and attach the project there as only images are allowed in forums for security reasons.

All the best,
Steve
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

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