Home / Support / Swiff Chart Generator / Simple Bar Chart - ASP.NET
Knowledge Base

SAMPLE: Simple Bar Chart - ASP.NET

The information in this article applies to:

  • Swiff Chart Generator 3

This example illustrates how to generate a simple bar chart in ASP.NET

using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;

using GlobFX.SwiffChartGenerator;

public partial class CSharp_QuickStarts_Bar : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
// Set the heading for the graph
chart.Title"Financial Results";
chart.Subtitle"(Values in M$ - Quarter results)";

// Set chart categories
chart.SetCategoriesFromArray( new string[] { "Q1""Q2""Q3" } );

// Fill chart series
chart.SetSeriesCaption( 0"First Series" );
chart.SetSeriesValuesFromArray( 0new double[] { 1.23.511.} );

chart.SetSeriesCaption( 1"Second Series" );
chart.SetSeriesValuesFromArray( 1new double[] { 2.34.59.} );

chart.SetSeriesCaption( 2"Third Series" );
chart.SetSeriesValuesFromArray( 2new double[] { 3.25.514.} );

// Apply a Bar style
        // The chart type is stored in the style file (*.scs)
        // Here the selected style is the predefined bar style "SanFrancisco"
chart.LoadStyle( @"bar\SanFrancisco" );

chart.Looping= false;

Keywords:ASP.NET Bar Chart

Swiff Chart Generator