Click here to Skip to main content
11,481,265 members (63,334 online)
Click here to Skip to main content

Fusion Charts Helper Class for ASP.NET 2.0 (C#)

, 9 Feb 2009 CPOL 67K 4.1K 34
Rate this:
Please Sign up or sign in to vote.
This helper class makes it easy to work with Fusion Charts.
FusionChartsHelper

Introduction

Fusion Charts help you to create animated and interactive Flash charts for web and desktop applications. You have to create the XML and pass it to the provided SWF files for each graph type. This helper class facilitates the process of creating the required XML and in the integration with the ASP.NET page.

Using the Code

The code lies in three files:

  1. Charts.cs

    This file contains FusionChartBase (abstract), FusionPieChart, FusionLineChart, and FusionChartUtility.

  2. DataSetHelper.cs

    This file is not related to Fusion Charts. It is a collection of useful code that I found here and there. You should check this out.

  3. Default.aspx

    The page contains two DIVs and a Button. Pie and line charts are loaded into the DIVs on the Button's Click event.

The classes are quite long, so I'm only including the button click code here:

protected void btnShow_Click(object sender, EventArgs e)
{
    FusionPieChart pieChart = new FusionPieChart();
    pieChart.showNames = true;
    pieChart.showPercentageInLabel = true;
    pieChart.showPercentageValues = false;
    string chartHtml = pieChart.CreateSetElement(BuildData(), FusionPieChart.Pie3D, 
                       divPieChart.ClientID, "name", "value", 
                       "text", "id", "test.aspx?id=", true, 600, 400);
    divPieChart.InnerHtml = chartHtml;

    FusionLineChart lineChart = new FusionLineChart();
    //chartHtml = lineChart.CreateSetElememtForTrendChart(BuildData(), 
                  divLineChart.ClientID, "name", "value", 100, 100);
    chartHtml = lineChart.CreateSetElement(BuildData(), FusionLineChart.Line2D, 
                divLineChart.ClientID, false, "", "name", 
                "value", "text", "id", "", true, 600, 400);
    divLineChart.InnerHtml = chartHtml;
}

Points of Interest

I did not use Adobe Flex because it was taking too much time for me to develop graphs, and Fusion Charts offered me a quick solution, but it has a number of limitations. After creating all these classes, I had to switch back to Adobe Flex. I used the Fusion Charts XML passing approach with Adobe Flex, and life is beautiful. Smile | :)

History

  • 9th February, 2009: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Shahid Syed
Software Developer (Senior) Mobile Complete Inc. (DeviceAnywhere)
Pakistan Pakistan
No Biography provided

Comments and Discussions

 
QuestionYou are Dude Pin
Member 983680417-Aug-13 2:29
memberMember 983680417-Aug-13 2:29 
GeneralMy vote of 2 Pin
zhaojs1-Aug-11 0:32
memberzhaojs1-Aug-11 0:32 
GeneralHelp on StackedChart2Column2D Pin
chandu_danlaw7-Dec-10 23:36
memberchandu_danlaw7-Dec-10 23:36 
GeneralMy vote of 1 Pin
WakoAivan12-Oct-10 7:21
memberWakoAivan12-Oct-10 7:21 
GeneralMy vote of 5 Pin
thatraja6-Oct-10 0:05
memberthatraja6-Oct-10 0:05 
GeneralVery useful..thank you .. Pin
Jeyaramasamy23-Mar-10 22:55
memberJeyaramasamy23-Mar-10 22:55 
GeneralError when the project is compiled Pin
Imran_hus9-Nov-09 2:33
memberImran_hus9-Nov-09 2:33 
GeneralThank You for the helper class Pin
JimmyRopes18-Sep-09 1:41
memberJimmyRopes18-Sep-09 1:41 
GeneralIt's Very nice and useful Pin
Sunasara Imdadhusen23-Jul-09 2:24
memberSunasara Imdadhusen23-Jul-09 2:24 
GeneralPie Chart Pin
bhupen_794-Jul-09 23:55
memberbhupen_794-Jul-09 23:55 
GeneralRe: Pie Chart Pin
mishaloveviks20-Oct-09 4:44
membermishaloveviks20-Oct-09 4:44 
GeneralHi Pin
Vijay9166-Jun-09 1:28
memberVijay9166-Jun-09 1:28 
Questionhow about Licence? Pin
davidberlin17-Mar-09 5:05
memberdavidberlin17-Mar-09 5:05 
AnswerRe: how about Licence? Pin
Shahid Syed29-Apr-09 2:09
memberShahid Syed29-Apr-09 2:09 
Questioncan you provide more chart type? [modified] Pin
JLKEngine00814-Mar-09 23:27
memberJLKEngine00814-Mar-09 23:27 
AnswerRe: can you provide more chart type? Pin
Shahid Syed29-Apr-09 2:05
memberShahid Syed29-Apr-09 2:05 
GeneralIt is very good!! Pin
JLKEngine00817-Feb-09 22:16
memberJLKEngine00817-Feb-09 22:16 
GeneralRe: It is very good!! Pin
Shahid Syed27-Feb-09 3:52
memberShahid Syed27-Feb-09 3:52 
JokeThank you Pin
blinkblink11-Feb-09 23:55
memberblinkblink11-Feb-09 23:55 
GeneralRe: Thank you Pin
Shahid Syed12-Feb-09 2:45
memberShahid Syed12-Feb-09 2:45 
GeneralRe: Thank you Pin
swapprose8-Jun-10 3:27
memberswapprose8-Jun-10 3:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150520.1 | Last Updated 9 Feb 2009
Article Copyright 2009 by Shahid Syed
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid