Charts,data from dataset-invalid cast exception nullable []

Stimulsoft Reports.NET discussion
Post Reply
rgbnr
Posts: 3
Joined: Wed Feb 13, 2013 1:27 pm

Charts,data from dataset-invalid cast exception nullable []

Post by rgbnr »

Hi

I've created two charts, in first I set data column to 45;34;78 in expresion editor and in value column 6;7;9, and chart is diplayed correctly.
In second I try set values from Dataset. In Data Source in ReportData I added column Years with type int and Percents with type int too.

To data set I pass properties Years as new int[] {3,4,5} and Percents as new int[] {6,7,8}.

Code: Select all

public int[] Percents { get; set; }
public int[] Years { get; set; }
...

Code: Select all

report.Percents = new int[] { 12, 34, 56 };
report.Years =  new int[] { 1, 2, 3, 5 };
DataTable mainReportDataTable = dataSet.Tables.Add("ReportData");
DataRow mainDataRow = mainReportDataTable.NewRow();

Code: Select all

 if (!mainDataRow .Table.Columns.Contains("Years"))
                        mainDataRow .Table.Columns.Add("Years");
                    mainDataRow ["Years"] =  report.Years;
and for percents as above

And when report is rendere it throw exception:
Invalid Cast Exception: {System.Nullable`1[System.Double][] GetValuesFromValueDataColumn(Stimulsoft.Report.Chart.StiChart, Stimulsoft.Report.Chart.StiSeries)}
I was trying replace int[] to int?[] or double?[] and still this same error occur.

It works when I replace int[] to int and assign Years = 7 but in chart I have only one value
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Charts,data from dataset-invalid cast exception nullable

Post by HighAley »

Hello.

Could you send us a sample project which reproduces the issue for analysis?

Thank you.
Post Reply