Hi,
I'm having chart in detail section. I need to bind the chart based on the item value of the report. I directly bind the chart in the detail_ItemDataBound without NeedDataSource event for the chart. I didn't get the chart. Then i try adding NeedDataSource event for the chart. But this gets executed before detail_ItemDataBound. Again I didn't get the chart. Then i tried detail_ItemDataBinding event to get value. Later i use the function for binding chart which i call in detail_ItemDataBound or in detail_ItemDataBinding. Still i didn't get the chart. All i get is there is no or empty series.
How can i bind the chart which is in detail section?
Here is the code which i use the bind the chart. Assume dt is DataTable holding data.
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
total += Convert.ToInt32(dt.Rows[i]["Cnt"]);
Telerik.Reporting.Processing.Chart chtCur = sender as Telerik.Reporting.Processing.Chart;
this.chtCur.Series.Clear();
this.chtCur.ChartTitle.TextBlock.Text = "Factors";
for (int i = 0; i < dt.Rows.Count; i++)
{
Telerik.Reporting.Charting.ChartSeries chartseries = new Telerik.Reporting.Charting.ChartSeries();
Telerik.Reporting.Charting.ChartSeriesItem item = new Telerik.Reporting.Charting.ChartSeriesItem();
item.Label.TextBlock.Text = dt.Rows[i]["Val"].ToString() + "\n" + (Convert.ToInt32(dt.Rows[i]["Cnt"]) / total * 100).ToString() + "%";
item.Name = dt.Rows[i]["Val"].ToString();
item.YValue = Convert.ToInt32(dt.Rows[i]["Cnt"]) / total * 100;
chartseries.Type = Telerik.Reporting.Charting.ChartSeriesType.Pie;
chartseries.Name = dt.Rows[i]["Val"].ToString();
chartseries.Items.Add(item);
this.chtCur.Series.Add(chartseries);
}
pnlCur.Visible = true;
}
else
pnlCur.Visible = false;
Please help.
Thanks in advance.
I'm having chart in detail section. I need to bind the chart based on the item value of the report. I directly bind the chart in the detail_ItemDataBound without NeedDataSource event for the chart. I didn't get the chart. Then i try adding NeedDataSource event for the chart. But this gets executed before detail_ItemDataBound. Again I didn't get the chart. Then i tried detail_ItemDataBinding event to get value. Later i use the function for binding chart which i call in detail_ItemDataBound or in detail_ItemDataBinding. Still i didn't get the chart. All i get is there is no or empty series.
How can i bind the chart which is in detail section?
Here is the code which i use the bind the chart. Assume dt is DataTable holding data.
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
total += Convert.ToInt32(dt.Rows[i]["Cnt"]);
Telerik.Reporting.Processing.Chart chtCur = sender as Telerik.Reporting.Processing.Chart;
this.chtCur.Series.Clear();
this.chtCur.ChartTitle.TextBlock.Text = "Factors";
for (int i = 0; i < dt.Rows.Count; i++)
{
Telerik.Reporting.Charting.ChartSeries chartseries = new Telerik.Reporting.Charting.ChartSeries();
Telerik.Reporting.Charting.ChartSeriesItem item = new Telerik.Reporting.Charting.ChartSeriesItem();
item.Label.TextBlock.Text = dt.Rows[i]["Val"].ToString() + "\n" + (Convert.ToInt32(dt.Rows[i]["Cnt"]) / total * 100).ToString() + "%";
item.Name = dt.Rows[i]["Val"].ToString();
item.YValue = Convert.ToInt32(dt.Rows[i]["Cnt"]) / total * 100;
chartseries.Type = Telerik.Reporting.Charting.ChartSeriesType.Pie;
chartseries.Name = dt.Rows[i]["Val"].ToString();
chartseries.Items.Add(item);
this.chtCur.Series.Add(chartseries);
}
pnlCur.Visible = true;
}
else
pnlCur.Visible = false;
Please help.
Thanks in advance.