Search code examples
c#.netpdfreportviewerreport-viewer2012

Column Chart not Rendering in PDF using ReportViewer Library?


Framework used : .Net Framework 4.5.2 Library used : Microsoft.ReportViewer.WinForms.dll(Version = 10.0.0.0)

My application is fetching the data from database and binding it to ReportDataSourceCollection. After that byte[] is returned from Render(). Finally the byte[] is written with fileStream.

Below Function is called public byte[] Render(string format, string deviceInfo, out string mimeType, out string encoding, out string fileNameExtension, out string[] streams, out Warning[] warnings);

Expected Result : PDF Report contains 1 column chart and table. Actual Result : Column chart is showing empty with some error on it as in attached image. & Table is getting populated with data.

Column Chart :

Y-axis : int values like 1375724,67802 etc. X-axis : string values like 939 - 1571,1572 - 2204 etc.

Investigation :

After my observations I found out that the values in Y-axis are creating problem in not rendering chart.Because by changing the values used for Y-axis chart is rendering.

The values that are creating problem are 3183938 and 2729807.

Can you tell me why the above numbers are creating when rendering to PDF Report ? Any workarounds for such case ?enter image description here


Solution

  • In the RDLC Chart,Y-axis has below Axis options earlier : Minimum - Auto Maximum - Auto Interval - Auto IntervalType - Number

    The values that are creating problem are 3183938 and 2729807.

    I changed the above IntervalType property from 'Number' to 'Auto' and the chart is rendered now.