I am binding a DataTable dynamically in code behind to a RadHtmlChart and adding ColumnSeries Objects to the PlotArea. The code I'm executing looks like this:
SqlDataAdapter da = new SqlDataAdapter(sqlCommand);
da.Fill(pivotTable);
for (int i = 2; i < pivotTable.Columns.Count; i++ )
{
ColumnSeries cs = new ColumnSeries();
cs.DataFieldY = pivotTable.Columns[i].ColumnName;
cs.Name = pivotTable.Columns[i].ColumnName;
cs.Gap = 1.5;
cs.Spacing = 0.4;
cs.Stacked = true;
cs.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.Center;
cs.TooltipsAppearance.Color = System.Drawing.Color.White;
GraphAvgWT.PlotArea.Series.Add(cs);
}
GraphAvgWT.DataSource = pivotTable;
GraphAvgWT.DataBind();
When I run this in any browser there is an exception thrown that looks like this:
Unhandled exception at line 869, column 1 in http://localhost:49573/ScriptResource.axd?d=WLmYcdOKb_LAUnVSHQHR_hSJ5_ioMpFtRv-OH10MfF6U9fb1aA_Wxx1ydL_Dzi9j6TRzmqrWagcWnKdo5Eq1K82yemCb8VeXhI_pB8YUERcZ9lmHzOgkSZqZJb4-cBN_QxRKGZb-mZqVdCLfssHYSg2&t=5ebf97e0
0x800a03ee - JavaScript runtime error: Expected ')'
As a result the chart does not contain any data, but the Legend shows all of the columns/series that I added. I've also compared this code to the GroupDataSource example (http://www.telerik.com/support/code-library/group-radhtmlchart-data-source) and I'm adding the series by a similar manner and setting the same properties on the ColumnSeries Object.
If I comment-out the line that reads "GraphAvgWT.PlotArea.Series.Add(cs);" the error goes away, but of course, there is no data in the chart.
Can you please help me resolve this issue? Thanks.
SqlDataAdapter da = new SqlDataAdapter(sqlCommand);
da.Fill(pivotTable);
for (int i = 2; i < pivotTable.Columns.Count; i++ )
{
ColumnSeries cs = new ColumnSeries();
cs.DataFieldY = pivotTable.Columns[i].ColumnName;
cs.Name = pivotTable.Columns[i].ColumnName;
cs.Gap = 1.5;
cs.Spacing = 0.4;
cs.Stacked = true;
cs.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.Center;
cs.TooltipsAppearance.Color = System.Drawing.Color.White;
GraphAvgWT.PlotArea.Series.Add(cs);
}
GraphAvgWT.DataSource = pivotTable;
GraphAvgWT.DataBind();
When I run this in any browser there is an exception thrown that looks like this:
Unhandled exception at line 869, column 1 in http://localhost:49573/ScriptResource.axd?d=WLmYcdOKb_LAUnVSHQHR_hSJ5_ioMpFtRv-OH10MfF6U9fb1aA_Wxx1ydL_Dzi9j6TRzmqrWagcWnKdo5Eq1K82yemCb8VeXhI_pB8YUERcZ9lmHzOgkSZqZJb4-cBN_QxRKGZb-mZqVdCLfssHYSg2&t=5ebf97e0
0x800a03ee - JavaScript runtime error: Expected ')'
As a result the chart does not contain any data, but the Legend shows all of the columns/series that I added. I've also compared this code to the GroupDataSource example (http://www.telerik.com/support/code-library/group-radhtmlchart-data-source) and I'm adding the series by a similar manner and setting the same properties on the ColumnSeries Object.
If I comment-out the line that reads "GraphAvgWT.PlotArea.Series.Add(cs);" the error goes away, but of course, there is no data in the chart.
Can you please help me resolve this issue? Thanks.