|
|
|
|
|
|
|
|
There are currently:
38 anonymous users online.
0 of 204 registered users online.
There have been 10464 Page Hits by
8012 users
|
|
|
|
|
Base Example
The following examples on this page generate the following chart
For lots more example code, you can click on any chart in the galleries to see the code that generates them.
C# Code
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using SasqChart;
namespace Chart
{
/// <summary>
/// Summary description for Example.
/// </summary>
public class Example : System.Windows.Forms.Form
{
private SasqChart.FormChartControl chart1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Example()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
PopulateChart();
}
private void PopulateChart()
{
chart1.YAxis.Max = 100;
chart1.Series[0].Type = ChartType.SmoothLine;
chart1.Series[0].Data.Add(new DataPoint( 5, "Jan"));
chart1.Series[0].Data.Add(new DataPoint(15, "Feb"));
chart1.Series[0].Data.Add(new DataPoint(33, "Mar"));
chart1.Series[0].Data.Add(new DataPoint(60, "Apr"));
chart1.Series[0].Data.Add(new DataPoint(34, "May"));
chart1.Series[0].Data.Add(new DataPoint(45, "Jun"));
chart1.Series[0].Data.Add(new DataPoint(80, "Jul"));
chart1.Series[0].Data.Add(new DataPoint(30, "Aug"));
chart1.Series[0].Data.Add(new DataPoint(32, "Sep"));
chart1.Series[0].Data.Add(new DataPoint(45, "Oct"));
chart1.Series[0].Data.Add(new DataPoint(23, "Nov"));
chart1.Series[0].Data.Add(new DataPoint(10, "Dec"));
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.chart1 = new SasqChart.FormChartControl();
this.SuspendLayout();
//
// chart1
//
this.chart1.Dock = System.Windows.Forms.DockStyle.Fill;
this.chart1.Header.Text = "Example Chart";
this.chart1.ChartStyle.FontColor = System.Drawing.Color.Black;
this.chart1.ChartStyle.Font = new System.Drawing.Font("Arial", 8F);
this.chart1.Location = new System.Drawing.Point(0, 0);
this.chart1.Name = "Example Chart";
this.chart1.Padding = 10;
this.chart1.Size = new System.Drawing.Size(500, 500);
this.chart1.TabIndex = 0;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(500, 500);
this.Controls.Add(this.chart1);
this.Name = "Example Chart";
this.Resize += new System.EventHandler(this.Form_Resize);
this.ResumeLayout(false);
}
#endregion
private void Form_Resize(object sender, System.EventArgs e)
{
Invalidate();
}
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Example());
}
}
}
|