0

I am using WSS 3.0 and am trying to display a Chart object from the System.Web.UI.DataVisualization.Charting namespace in a custom Web Part. My Web Part was built in C# in Visual Studio 2008, and I am using WSP Builder to deploy. My ultimate goal is to show items from a List in the chart, but at the moment I am just making a simple chart with one series. My code works on an ASP.NET WebForm, but when I copy and paste the code to a custom Web Part, all I see is a rectangle with the red X.

Here is my code, though I think the problem is elsewhere:

Chart Chart1 = new Chart();
Chart1.ChartAreas.Add("ChartArea1");
Chart1.Series.Add("Series1");
for (int 1 = 0; i <= 50; i++)
Chart1.Series["Series1"].Points.AddXY(i, i*2);
this.Controls.Add(Chart1);
1

Add below tag under section of web.config of the web application where you are using it and create a folder "C:\TempImageFiles"

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.