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.
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?
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?