Create Your First Chart

Let's create a Column 2D chart showing the "Most popular programming language".

The chart will look as shown below:

FusionCharts will load here..

Click here to edit the column chart.

The data for the above chart is shown in the table below:

Programming Language Users
Java 62000
Python 46000
JavaScript 38000
C++ 31000
C# 27000
PHP 14000
Perl 14000

Now that you have the tabular data ready, let's see how to render the chart.

Render the chart

Create the FirstChart.aspx.cs file and do the following:

  • Include the FusionCharts.DataEngine and FusionCharts.Visualization .dll files.
  • Create DataTable.
  • Create a StaticSource using the DataTable.
  • Create an instance of DataModel class.
  • Add two columns and multiple rows to the DataTable.
  • Add DataSource to the DataModel.
  • Instantiate Column Chart
  • Set chart width and height
  • Set DataModel instance as the data source of the chart.
  • Optionally, set chart title, subtitle, X-axis text, and Y-axis text.
  • Optionally, set the chart theme as fusion.
  • Return the chart rendering configuration into the server side literal, or set the chart configuration as Literal.text.

The code is shown below:

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FusionCharts.DataEngine;
using FusionCharts.Visualization;

namespace FusionChartsVisualisationWebFormsSamples.Samples
    public partial class FirstChart: System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)
           DataTable ChartData = new DataTable();
            ChartData.Columns.Add("Programming Language", typeof(System.String));
            ChartData.Columns.Add("Users", typeof(System.Double));

            // Create static source with this data table
            StaticSource source = new StaticSource(ChartData);
            // Create instance of DataModel class
            DataModel model = new DataModel();
            // Add DataSource to the DataModel
            // Instantiate Column Chart
            Charts.ColumnChart column = new Charts.ColumnChart("first_chart");
            // Set Chart's width and height
            // Set DataModel instance as the data source of the chart
            column.Data.Source = model;
            // Set Chart Title
            column.Caption.Text = "Most popular programming language";
            // Sset chart sub title
            column.SubCaption.Text = "2017-2018";

            // set XAxis Text
            column.XAxis.Text = "Programming Language";
            // Set YAxis title
            column.YAxis.Text = "User";
            column.ThemeName = FusionChartsTheme.ThemeName.FUSION;
            // Render the chart to 'Literal1' literal control
            Literal1.Text = column.Render();

The .aspx template for the above sample is shown below:

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <script type="text/javascript" src="//"></script>
    <script type="text/javascript" src="//"></script>

    <form id="form1" runat="server">
            <asp:Literal ID="Literal1" runat="server"></asp:Literal>

That's it! Your first chart is ready.

You can download the samples for FusionCharts.NET from here.