0

I am trying to create Chart with 2 series and 2 ChartArea. I have following code:

 protected void DisplayData()
{
    var surveyResult = SurveyResult.ListSurveyResult(this.SurveyID);

    for (int i = 0; i < surveyResult.Count; i++)
    {
        Series series = new Series();
        series.Name = i.ToString();
        series.ChartArea = "ChartArea" + i.ToString();
        series.ChartType = SeriesChartType.Pie;

        DataPoint point = new DataPoint();
        point.SetValueY(Convert.ToInt32(surveyResult[i].Person_Count));
        point.AxisLabel = surveyResult[i].Answer;
        series.Points.Add(point);

        ChartArea chartArea = new ChartArea();
        chartArea.Name = "ChartArea" + i.ToString();
        Chart1.ChartAreas.Add(chartArea);

        Chart1.Series.Add(series);
    }
    Chart1.DataBind();
}

I am getting 'Error executing child request for ChartImg.axd.' error. I also tryed to include

  <add key="ChartImageHandler" value="storage=file;timeout=20;" />

in web.config file but without success. Does anyone know what is this problem about?

coder
  • 658
  • 3
  • 14
  • 31

1 Answers1

0

After additional searching on the web I found that I should add the following code:

 <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />

to the web.config file.

coder
  • 658
  • 3
  • 14
  • 31