XML Serialization with FusionCharts in ASP.NET April 30, 2009 at 9:36 pm
FusionCharts offers a set of ASP.NET compatible Charts that one can download for development and testing. They have great documentation on their site so I’m not getting into that.
I wrote a program that lets you populate the chart easily with your own data. Download the sample and go to the code behind for Default.aspx.cs line 33:
//Set your custom data output here
string[] Labels = { “Jan”, “Feb”, “March” };
string[] Values = { “174″, “18100″, “20000″ };
int count = 0;
setItems[] setItems = new setItems[Labels.Length];
foreach (string lbl in Labels)
{
setItems[count] = new setItems();
setItems[count].Lbl = Labels[count];
setItems[count].Val = Values[count];
count++;
}
You can add the rest of the months of the year and your own data to display or you can totally change the date range and type of data by changing the other options of the class:
chart.Caption = “Monthly Sales Summary”; //Customizing the caption
The project is made in Visual Studio 2008 and should work as is save 1 detail: go into the Web.config and change the following key:
<add key=”DataDirectory” value=”C:\Users\Brian\Documents\Visual Studio 2008\Projects\FusionChartSerializer\FusionChartSerializer\Data” />
To point to wherever your Data File is (the Data folder within the FusionChartSerializer project).
Leave a Reply