Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

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

, 9 Feb 2009 CPOL
This helper class makes it easy to work with Fusion Charts.
FusionChartsHelper.zip
FusionChartsHelper
App_Code
App_Data
Bin
FusionCharts.dll
FusionCharts
FCF_Area2D.swf
FCF_Bar2D.swf
FCF_Candlestick.swf
FCF_Column2D.swf
FCF_Column3D.swf
FCF_Doughnut2D.swf
FCF_Funnel.swf
FCF_Gantt.swf
FCF_Line.swf
FCF_MSArea2D.swf
FCF_MSBar2D.swf
FCF_MSColumn2D.swf
FCF_MSColumn2DLineDY.swf
FCF_MSColumn3D.swf
FCF_MSColumn3DLineDY.swf
FCF_MSLine.swf
FCF_Pie2D.swf
FCF_Pie3D.swf
FCF_StackedArea2D.swf
FCF_StackedBar2D.swf
FCF_StackedColumn2D.swf
FCF_StackedColumn3D.swf
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    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;
    }

    private DataTable BuildData()
    {
        //DataTable dtChart, string nameField, string valueField, string hoverTextField, string urlField, string urlPrefix, int chartWidth, int chartHeight

        DataTable dtData = new DataTable();

        dtData.Columns.Add("name");
        dtData.Columns.Add("value");
        dtData.Columns.Add("text");
        dtData.Columns.Add("id");

        DataRow drData = null;

        drData = dtData.NewRow();

        drData["name"] = "name51";
        drData["value"] = "51";
        drData["text"] = "text51";
        drData["id"] = "";

        dtData.Rows.Add(drData);


        drData = dtData.NewRow();

        drData["name"] = "name32";
        drData["value"] = "32";
        drData["text"] = "text52";
        drData["id"] = "52";
        dtData.Rows.Add(drData);

        drData = dtData.NewRow();

        drData["name"] = "name69";
        drData["value"] = "69";
        drData["text"] = "text69";
        drData["id"] = "69";
        dtData.Rows.Add(drData);

        drData = dtData.NewRow();

        drData["name"] = "name22";
        drData["value"] = "0";
        drData["text"] = "text22";
        drData["id"] = "22";
        dtData.Rows.Add(drData);

        drData = dtData.NewRow();

        drData["name"] = "name51";
        drData["value"] = "51";
        drData["text"] = "text51";
        drData["id"] = "0";
        dtData.Rows.Add(drData);

        drData = dtData.NewRow();

        drData["name"] = "name202";
        drData["value"] = "202";
        drData["text"] = "text202";
        drData["id"] = "202";
        dtData.Rows.Add(drData);

        return dtData;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

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

| Advertise | Privacy | Mobile
Web02 | 2.8.141022.2 | Last Updated 9 Feb 2009
Article Copyright 2009 by Shahid Syed
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid