SAMPLE: Simple Line Chart - ASP.NET
The information in this article applies to:
- Swiff Chart Generator 3
This example illustrates how to generate a simple line 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_Line : 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(0, new double[] { 1.2, 3.5, 11.3 });
chart.SetSeriesCaption(1, "Second Series");
chart.SetSeriesValuesFromArray(1, new double[] { 2.3, 4.5, 9.3 });
chart.SetSeriesCaption(2, "Third Series");
chart.SetSeriesValuesFromArray(2, new double[] { 3.2, 5.5, 14.3 });
// Apply a Line style
// The chart type is stored in the style file (*.scs)
// Here the selected style is the predefined line style "Honolulu"
chart.LoadStyle(@"line\Honolulu");
chart.Looping= false;
}
}
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_Line : 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(0, new double[] { 1.2, 3.5, 11.3 });
chart.SetSeriesCaption(1, "Second Series");
chart.SetSeriesValuesFromArray(1, new double[] { 2.3, 4.5, 9.3 });
chart.SetSeriesCaption(2, "Third Series");
chart.SetSeriesValuesFromArray(2, new double[] { 3.2, 5.5, 14.3 });
// Apply a Line style
// The chart type is stored in the style file (*.scs)
// Here the selected style is the predefined line style "Honolulu"
chart.LoadStyle(@"line\Honolulu");
chart.Looping= false;
}
}
Keywords: | ASP.NET Line Chart |