1

I have created a report in Active Reports (.rpx file) which contains a chartcontrol 'ChartControl1'. Report Datasource is List which contains 'ItemLabel' and 'ItemValue' fields Script file contains following line of code.

public void ActiveReport_ReportStart()
{
    this.ChartControl1.DataSource = rpt.DataSource;
    this.ChartControl1.Series[0].ValueMemberX = "ItemLabel";
    this.ChartControl1.Series[0].ValueMembersY = "ItemValue";
}

Apparently i am getting an error which says

"DataSource of type System.String is not supported .Parameter name: genericDataSource"

and this line is causing the problem.

this.ChartControl1.Series[0].ValueMembersY = "ItemValue";

because if i remove this line , there is no error , but report would not render. I have read that this error is happening due to incorrect binding , but it is not the case here as i have doublechecked it.

What could be the issue?

NewtonCode
  • 1,322
  • 5
  • 14
  • 25

2 Answers2

0

This error is usually observed when a string value is assigned to the ValueMemebersY property of chart series, where the string value is not a valid field/column name in the table that is bound to the chart as it’s datasource.

Please refer to the walkthrough which describes how to create an unbound bar chart at runtime with SectionReports (Rpx as well as code based)

You can additionally refer the charting sample that is shipped along with ActiveReports.

You may also refer to the following forum post wherein a sample has been attached showing a similar implementation: http://our.componentone.com/groups/topic/chart-control-throwing-a-binding-error/

Regards, Mohita

MohitaM
  • 41
  • 2
  • I have double checked to confirm that string value attached is a valid field in the datasource. Could you please check the lat post in following link [link] http://our.componentone.com/groups/topic/datasource-of-type-system-string-is-not-supported-on-bar-chart/ – NewtonCode Mar 05 '14 at 12:58
  • DataTable table = new DataTable(); table.Columns.Add("ItemLabel", typeof(string)); table.Columns.Add("ItemValue", typeof(double)); table.Rows.Add("Won", 5.0); table.Rows.Add("Lost", 7.0); this.chartControl1.DataSource = table; this.chartControl1.Series[0].ValueMemberX = "ItemLabel"; this.chartControl1.Series[0].ValueMembersY = ItemValue"; i have added same code in rpx and codebased report containing chart.but rpx throws error each time , while no issue in codebased sample.why is that? – NewtonCode Mar 05 '14 at 13:01
0

NewtonCode

what version of product are you using? version 7 or 8? Its a bug. we are going to fix it.

Rajnish Sinha
  • 406
  • 2
  • 4
  • We are using version 7 – NewtonCode Mar 07 '14 at 04:50
  • What we have found out that one particular node gets written out is not correct. How did you generate the rpx? This node is: But generally, if we create a chart, the DataSourceDirect should be written like this, That special-value="null" attribute/value pair is missing. There are some special handling that are done based on the presence or absence of that attribute. Let me know. thanks. – Rajnish Sinha Apr 04 '14 at 16:18
  • I generated rpx from visual studio (addnew->sectionreportxmlbased).i havent edited the rpx file to remove that attribute.need to investigate under what condition the attribute dissapears. I have now edited the rpx to include attribute 'special-value=null' to DataSourceDirect node ( in my test i uploaded ) and it still is showing same error. – NewtonCode Apr 07 '14 at 05:34
  • k thanks. Will let the team know and see what they have to say. – Rajnish Sinha Apr 07 '14 at 17:18
  • Can you also tell us what build number you have installed please. Are you able to reproduce this consistently? We have been trying all different ways to reproduce a rpx with the errant datasourcedirect node, but so far we have been unsuccessful. Is there a specific step in there for chart? just drag the chart on the designer? Do you something else after that? – Rajnish Sinha Apr 09 '14 at 03:32