using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Diagnostics;
using System.IO;

using C1.Win.C1Chart;

namespace Canvas_C1Chart
{

	/// <summary>
	/// Summary description for FormChart2D.
	/// </summary>
	public class FormChart2D : System.Windows.Forms.Form
	{
		private System.Windows.Forms.PropertyGrid propertyGrid1;
		private C1.Win.C1Chart.C1Chart C1Chart1;
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.MenuItem menuItem4;
		private System.Windows.Forms.MenuItem menuItem5;
		private System.Windows.Forms.MenuItem menuItem6;
		private System.Windows.Forms.MenuItem menuItem7;
		private System.Windows.Forms.MenuItem menuItem8;
		private System.Windows.Forms.MenuItem menuItem9;
		private System.Windows.Forms.MenuItem menuItem10;
		private System.Windows.Forms.MenuItem menuItem11;
		private System.Windows.Forms.MenuItem menuItem12;
		private System.Windows.Forms.MenuItem menuItem13;
		private System.Windows.Forms.MenuItem menuItem14;
		private System.Windows.Forms.MenuItem menuItem15;
		private System.Windows.Forms.MenuItem menuItem16;
		private System.Windows.Forms.MenuItem menuItem17;
		private System.Windows.Forms.MenuItem menuItem18;
		private System.Windows.Forms.MenuItem menuItem19;
		private System.Windows.Forms.MenuItem menuItem3;
		private System.Windows.Forms.MenuItem menuItem20;

		private const string cInfoLabel = "FloatingInfo";
		private const float hole_value = float.MaxValue;
		private System.Windows.Forms.MenuItem menuItem21;
		private int m_unique = 0;
		private System.Windows.Forms.MenuItem menuItem22;
		private System.Windows.Forms.MenuItem menuItem23;
		private System.Windows.Forms.MenuItem menuItem24;
		private System.Windows.Forms.MenuItem menuItem25;
		private System.Windows.Forms.MenuItem menuItem26;
		private System.Windows.Forms.MenuItem menuItem27;
		private System.Windows.Forms.MenuItem menuItem28;
		private System.Windows.Forms.MenuItem menuItem29;
		private System.Windows.Forms.MenuItem menuItem30;
		private System.Windows.Forms.MenuItem menuItem31;
		private System.Windows.Forms.MenuItem menuItem32;
		private System.Windows.Forms.MenuItem menuItem33;
		private System.Windows.Forms.MenuItem menuItem34;
		private System.Windows.Forms.MenuItem menuItem35;
		private System.Windows.Forms.MenuItem menuItem36;
		private System.Windows.Forms.MenuItem menuItem37;
		private System.Windows.Forms.MenuItem menuItem38;
		private System.Windows.Forms.MenuItem menuItem39;
		private System.Windows.Forms.MenuItem menuItem40;
		private System.Windows.Forms.MenuItem menuItem41;
		private System.Windows.Forms.MenuItem menuItem42;
		private System.Windows.Forms.MenuItem menuItem43;
		private System.Windows.Forms.MenuItem menuItem44;
		private System.Windows.Forms.MenuItem menuItem45;
		private System.Windows.Forms.MenuItem menuItem46;

		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public FormChart2D()
		{
			InitializeComponent();
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		public new void Dispose()
		{
			base.Dispose();
			if(components != null)
				components.Dispose();
		}

		#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.menuItem19 = new System.Windows.Forms.MenuItem();
			this.menuItem18 = new System.Windows.Forms.MenuItem();
			this.menuItem15 = new System.Windows.Forms.MenuItem();
			this.menuItem14 = new System.Windows.Forms.MenuItem();
			this.menuItem16 = new System.Windows.Forms.MenuItem();
			this.menuItem17 = new System.Windows.Forms.MenuItem();
			this.menuItem11 = new System.Windows.Forms.MenuItem();
			this.menuItem10 = new System.Windows.Forms.MenuItem();
			this.menuItem13 = new System.Windows.Forms.MenuItem();
			this.menuItem12 = new System.Windows.Forms.MenuItem();
			this.C1Chart1 = new C1.Win.C1Chart.C1Chart();
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.menuItem28 = new System.Windows.Forms.MenuItem();
			this.menuItem3 = new System.Windows.Forms.MenuItem();
			this.menuItem20 = new System.Windows.Forms.MenuItem();
			this.menuItem33 = new System.Windows.Forms.MenuItem();
			this.menuItem21 = new System.Windows.Forms.MenuItem();
			this.menuItem29 = new System.Windows.Forms.MenuItem();
			this.menuItem22 = new System.Windows.Forms.MenuItem();
			this.menuItem23 = new System.Windows.Forms.MenuItem();
			this.menuItem24 = new System.Windows.Forms.MenuItem();
			this.menuItem25 = new System.Windows.Forms.MenuItem();
			this.menuItem26 = new System.Windows.Forms.MenuItem();
			this.menuItem30 = new System.Windows.Forms.MenuItem();
			this.menuItem27 = new System.Windows.Forms.MenuItem();
			this.menuItem32 = new System.Windows.Forms.MenuItem();
			this.menuItem31 = new System.Windows.Forms.MenuItem();
			this.menuItem4 = new System.Windows.Forms.MenuItem();
			this.menuItem6 = new System.Windows.Forms.MenuItem();
			this.menuItem34 = new System.Windows.Forms.MenuItem();
			this.menuItem42 = new System.Windows.Forms.MenuItem();
			this.menuItem43 = new System.Windows.Forms.MenuItem();
			this.menuItem44 = new System.Windows.Forms.MenuItem();
			this.menuItem45 = new System.Windows.Forms.MenuItem();
			this.menuItem35 = new System.Windows.Forms.MenuItem();
			this.menuItem36 = new System.Windows.Forms.MenuItem();
			this.menuItem37 = new System.Windows.Forms.MenuItem();
			this.menuItem38 = new System.Windows.Forms.MenuItem();
			this.menuItem39 = new System.Windows.Forms.MenuItem();
			this.menuItem40 = new System.Windows.Forms.MenuItem();
			this.menuItem8 = new System.Windows.Forms.MenuItem();
			this.menuItem9 = new System.Windows.Forms.MenuItem();
			this.menuItem7 = new System.Windows.Forms.MenuItem();
			this.menuItem5 = new System.Windows.Forms.MenuItem();
			this.menuItem41 = new System.Windows.Forms.MenuItem();
			this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
			this.menuItem46 = new System.Windows.Forms.MenuItem();
			((System.ComponentModel.ISupportInitialize)(this.C1Chart1)).BeginInit();
			this.SuspendLayout();
			// 
			// menuItem19
			// 
			this.menuItem19.Index = 5;
			this.menuItem19.Text = "Default Print";
			this.menuItem19.Click += new System.EventHandler(this.menuItem19_Click);
			// 
			// menuItem18
			// 
			this.menuItem18.Index = 2;
			this.menuItem18.Text = "-";
			// 
			// menuItem15
			// 
			this.menuItem15.Index = 0;
			this.menuItem15.Text = "Page Setup ...";
			this.menuItem15.Click += new System.EventHandler(this.menuItem15_Click);
			// 
			// menuItem14
			// 
			this.menuItem14.Index = 1;
			this.menuItem14.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					   this.menuItem15,
																					   this.menuItem16,
																					   this.menuItem18,
																					   this.menuItem17});
			this.menuItem14.Text = "Printer";
			// 
			// menuItem16
			// 
			this.menuItem16.Index = 1;
			this.menuItem16.Text = "Printer Setup ...";
			this.menuItem16.Click += new System.EventHandler(this.menuItem16_Click);
			// 
			// menuItem17
			// 
			this.menuItem17.Index = 3;
			this.menuItem17.Text = "Dialog on Print";
			this.menuItem17.Click += new System.EventHandler(this.menuItem17_Click);
			// 
			// menuItem11
			// 
			this.menuItem11.Index = 3;
			this.menuItem11.Text = "ScaleToMax";
			this.menuItem11.Click += new System.EventHandler(this.menuItem11_Click);
			// 
			// menuItem10
			// 
			this.menuItem10.Index = 2;
			this.menuItem10.Text = "ScaleToHeight";
			this.menuItem10.Click += new System.EventHandler(this.menuItem10_Click);
			// 
			// menuItem13
			// 
			this.menuItem13.Index = 0;
			this.menuItem13.Text = "ScaleNone";
			this.menuItem13.Click += new System.EventHandler(this.menuItem13_Click);
			// 
			// menuItem12
			// 
			this.menuItem12.Index = 4;
			this.menuItem12.Text = "ScaleToWidth";
			this.menuItem12.Click += new System.EventHandler(this.menuItem12_Click);
			// 
			// C1Chart1
			// 
			this.C1Chart1.BackColor = System.Drawing.Color.SlateGray;
			this.C1Chart1.DataSource = null;
			this.C1Chart1.Location = new System.Drawing.Point(328, 24);
			this.C1Chart1.Name = "C1Chart1";
			this.C1Chart1.PropBag = "<?xml version=\"1.0\"?><Chart2DPropBag Version=\"\"><StyleCollection><NamedStyle Name" +
				"=\"PlotArea\" ParentName=\"Area\"><StyleData>Border=Solid,Black,1;BackColor=WhiteSmo" +
				"ke;</StyleData></NamedStyle><NamedStyle Name=\"Legend\" ParentName=\"Control\"><Styl" +
				"eData>Border=Solid,ControlText,1;AlignHorz=Center;BackColor=Info;Wrap=False;Alig" +
				"nVert=Top;</StyleData></NamedStyle><NamedStyle Name=\"Footer\" ParentName=\"Control" +
				"\"><StyleData>ForeColor=Navy;Border=InsetBevel,255, 192, 192,3;BackColor=255, 192" +
				", 192;Font=Tahoma, 12pt, style=Bold;</StyleData></NamedStyle><NamedStyle Name=\"A" +
				"rea\" ParentName=\"Control\"><StyleData>Border=None,Black,1;BackColor=255, 224, 192" +
				";AlignVert=Top;</StyleData></NamedStyle><NamedStyle Name=\"Control\" ParentName=\"\"" +
				"><StyleData>ForeColor=ControlText;Border=Groove,Black,4;BackColor=SlateGray;</St" +
				"yleData></NamedStyle><NamedStyle Name=\"AxisX\" ParentName=\"Area\"><StyleData>Font=" +
				"Microsoft Sans Serif, 10pt, style=Bold;AlignVert=Bottom;AlignHorz=Center;ForeCol" +
				"or=DarkGreen;Rotation=Rotate0;Border=None,Black,1;Opaque=False;BackColor=Transpa" +
				"rent;</StyleData></NamedStyle><NamedStyle Name=\"Style3\" ParentName=\"LabelStyleDe" +
				"fault\"><StyleData>BackColor=MistyRose;</StyleData></NamedStyle><NamedStyle Name=" +
				"\"Style2\" ParentName=\"LabelStyleDefault\"><StyleData>BackColor=Wheat;</StyleData><" +
				"/NamedStyle><NamedStyle Name=\"LabelStyleDefault\" ParentName=\"Control\"><StyleData" +
				">Border=Solid,ControlText,1;BackColor=Transparent;</StyleData></NamedStyle><Name" +
				"dStyle Name=\"AxisY\" ParentName=\"Area\"><StyleData>Font=Microsoft Sans Serif, 10pt" +
				", style=Bold;AlignVert=Center;AlignHorz=Near;Rotation=Rotate270;Border=None,Blac" +
				"k,1;Opaque=False;BackColor=Transparent;</StyleData></NamedStyle><NamedStyle Name" +
				"=\"Header\" ParentName=\"Control\"><StyleData>ForeColor=Red;Border=RaisedBevel,Navy," +
				"3;BackColor=Navy;Font=Arial Black, 12pt, style=Bold;</StyleData></NamedStyle><Na" +
				"medStyle Name=\"Style1\" ParentName=\"LabelStyleDefault\"><StyleData>BackColor=Powde" +
				"rBlue;</StyleData></NamedStyle><NamedStyle Name=\"AxisY2\" ParentName=\"Area\"><Styl" +
				"eData>Rotation=Rotate90;Border=None,Black,1;AlignHorz=Far;BackColor=Transparent;" +
				"AlignVert=Center;</StyleData></NamedStyle></StyleCollection><ChartGroupsCollecti" +
				"on><ChartGroup><DataSerializer Hole=\"3.4028234663852886E+38\" DefaultSet=\"True\"><" +
				"DataSeriesCollection><DataSeriesSerializer FitType=\"Spline\"><LineStyle Color=\"Da" +
				"rkGoldenrod\" /><SymbolStyle Color=\"Coral\" Shape=\"Box\" /><SeriesLabel>series 0</S" +
				"eriesLabel><X>1;2;3;4;5</X><Y>20;22;19;24;25</Y><Y1>20;22;19;24;25</Y1><Y2>20;22" +
				";19;24;25</Y2><Y3>20;22;19;24;25</Y3><DataTypes>Single;Single;Single;Single;Sing" +
				"le</DataTypes><DataFields>;;;;</DataFields><Tag /></DataSeriesSerializer><DataSe" +
				"riesSerializer><LineStyle Color=\"DarkGray\" /><SymbolStyle Color=\"CornflowerBlue\"" +
				" Shape=\"Dot\" /><SeriesLabel>series 1</SeriesLabel><X>1;2;3;4;5</X><Y>8;12;10;12;" +
				"15</Y><Y1>8;12;10;12;15</Y1><Y2>8;12;10;12;15</Y2><Y3>8;12;10;12;15</Y3><DataTyp" +
				"es>Single;Single;Single;Single;Single</DataTypes><DataFields>;;;;</DataFields><T" +
				"ag /></DataSeriesSerializer><DataSeriesSerializer FitType=\"Spline\"><LineStyle Co" +
				"lor=\"DarkGreen\" /><SymbolStyle Color=\"Cornsilk\" Shape=\"Tri\" /><SeriesLabel>serie" +
				"s 2</SeriesLabel><X>1;2;3;4;5</X><Y>10;16;17;15;23</Y><Y1>10;16;17;15;23</Y1><Y2" +
				">10;16;17;15;23</Y2><Y3>10;16;17;15;23</Y3><DataTypes>Single;Single;Single;Singl" +
				"e;Single</DataTypes><DataFields>;;;;</DataFields><Tag /></DataSeriesSerializer><" +
				"DataSeriesSerializer FitType=\"Spline\"><LineStyle Color=\"DarkKhaki\" /><SymbolStyl" +
				"e Color=\"Crimson\" Shape=\"Diamond\" /><SeriesLabel>series 3</SeriesLabel><X>1;2;3;" +
				"4;5</X><Y>16;19;15;22;18</Y><Y1>16;19;15;22;18</Y1><Y2>16;19;15;22;18</Y2><Y3>16" +
				";19;15;22;18</Y3><DataTypes>Single;Single;Single;Single;Single</DataTypes><DataF" +
				"ields>;;;;</DataFields><Tag /></DataSeriesSerializer></DataSeriesCollection></Da" +
				"taSerializer><Name>Group1</Name><Stacked>False</Stacked><ChartType>XYPlot</Chart" +
				"Type><Pie>OtherOffset=0,Start=0</Pie><Bar>ClusterOverlap=0,ClusterWidth=50</Bar>" +
				"<HiLoData>FillFalling=True,FillTransparent=True,FullWidth=False,ShowClose=True,S" +
				"howOpen=True</HiLoData><Bubble>EncodingMethod=Diameter,MaximumSize=20,MinimumSiz" +
				"e=5</Bubble><Polar>Degrees=True,PiRatioAnnotations=True,Start=0</Polar><Radar>De" +
				"grees=True,Filled=False,Start=0</Radar><Visible>True</Visible><ShowOutline>True<" +
				"/ShowOutline></ChartGroup><ChartGroup><DataSerializer Hole=\"3.4028234663852886E+" +
				"38\" /><Name>Group2</Name><Stacked>False</Stacked><ChartType>XYPlot</ChartType><P" +
				"ie>OtherOffset=0,Start=0</Pie><Bar>ClusterOverlap=0,ClusterWidth=50</Bar><HiLoDa" +
				"ta>FillFalling=True,FillTransparent=True,FullWidth=False,ShowClose=True,ShowOpen" +
				"=True</HiLoData><Bubble>EncodingMethod=Diameter,MaximumSize=20,MinimumSize=5</Bu" +
				"bble><Polar>Degrees=True,PiRatioAnnotations=True,Start=0</Polar><Radar>Degrees=T" +
				"rue,Filled=False,Start=0</Radar><Visible>True</Visible><ShowOutline>True</ShowOu" +
				"tline></ChartGroup></ChartGroupsCollection><Header Compass=\"North\"><Text>Red Hea" +
				"der</Text></Header><Footer Compass=\"South\"><Text>BlueFooter</Text></Footer><Lege" +
				"nd Compass=\"East\" Visible=\"True\"><Text>Legend</Text></Legend><ChartArea /><Axes>" +
				"<Axis Max=\"5\" Min=\"1\" UnitMajor=\"1\" UnitMinor=\"0.5\" AutoMajor=\"True\" AutoMinor=\"" +
				"True\" AutoMax=\"True\" AutoMin=\"True\" _onTop=\"0\" Compass=\"South\"><Text>Green X-Axi" +
				"s</Text><GridMajor Visible=\"True\" Spacing=\"1\" AutoSpace=\"True\" Color=\"LightGray\"" +
				" Pattern=\"Dash\" /><GridMinor AutoSpace=\"True\" Color=\"LightGray\" Pattern=\"Dash\" /" +
				"><ValueLabels><ValueLabel Text=\"Zero\" /></ValueLabels></Axis><Axis Max=\"25\" Min=" +
				"\"5\" UnitMajor=\"5\" UnitMinor=\"2.5\" AutoMajor=\"True\" AutoMinor=\"True\" AutoMax=\"Tru" +
				"e\" AutoMin=\"True\" _onTop=\"0\" Compass=\"West\"><Text>Black Y-Axis</Text><GridMajor " +
				"Visible=\"True\" Spacing=\"5\" AutoSpace=\"True\" Color=\"LightGray\" Pattern=\"Dash\" /><" +
				"GridMinor AutoSpace=\"True\" Color=\"LightGray\" Pattern=\"Dash\" /></Axis><Axis Max=\"" +
				"0\" Min=\"0\" UnitMajor=\"0\" UnitMinor=\"0\" AutoMajor=\"True\" AutoMinor=\"True\" AutoMax" +
				"=\"True\" AutoMin=\"True\" _onTop=\"0\" Compass=\"East\" Visible=\"False\"><Text /><GridMa" +
				"jor AutoSpace=\"True\" Color=\"LightGray\" Pattern=\"Dash\" /><GridMinor AutoSpace=\"Tr" +
				"ue\" Color=\"LightGray\" Pattern=\"Dash\" /></Axis></Axes><AlarmZones><AlarmZone Back" +
				"Color=\"MistyRose\" ForeColor=\"Transparent\" Visible=\"True\" NearExtent=\"2\" FarExten" +
				"t=\"4\" LowerExtent=\"14\" UpperExtent=\"18\"><Name>zone0</Name></AlarmZone></AlarmZon" +
				"es><LabelsCollection><Label AttachMethod=\"DataIndex\" Connected=\"True\" Offset=\"10" +
				"\" Compass=\"East\" Visible=\"True\"><AttachMethodData>GroupIndex=0,PointIndex=2,Seri" +
				"esIndex=1,X=-1,Y=-1</AttachMethodData><StyleName>Style1</StyleName><Text>Line Fi" +
				"t</Text><Name>LineFit</Name></Label><Label AttachMethod=\"DataIndex\" Connected=\"T" +
				"rue\" Offset=\"10\" Compass=\"West\" Visible=\"True\"><AttachMethodData>GroupIndex=0,Po" +
				"intIndex=3,SeriesIndex=0,X=-1,Y=-1</AttachMethodData><StyleName>Style2</StyleNam" +
				"e><Text>Spline Fit</Text><Name>SplineFit</Name></Label><Label AttachMethod=\"Data" +
				"Coordinate\" Connected=\"True\" Offset=\"8\" Compass=\"South\" Visible=\"True\"><AttachMe" +
				"thodData>GroupIndex=0,PointIndex=-1,SeriesIndex=-1,X=3.5,Y=14</AttachMethodData>" +
				"<StyleName>Style3</StyleName><Text>AlarmZone</Text><Name>AlarmZone</Name></Label" +
				"></LabelsCollection></Chart2DPropBag>";
			this.C1Chart1.Size = new System.Drawing.Size(336, 360);
			this.C1Chart1.TabIndex = 1;
			this.C1Chart1.ForeColorChanged += new System.EventHandler(this.Chart1_ForeColorChanged);
			this.C1Chart1.FontChanged += new System.EventHandler(this.Chart1_FontChanged);
			this.C1Chart1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Chart1_MouseUp);
			this.C1Chart1.BackColorChanged += new System.EventHandler(this.Chart1_BackColorChanged);
			this.C1Chart1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Chart1_MouseMove);
			// 
			// mainMenu1
			// 
			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem1,
																					  this.menuItem14,
																					  this.menuItem41,
																					  this.menuItem46});
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 0;
			this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem2,
																					  this.menuItem28,
																					  this.menuItem3,
																					  this.menuItem20,
																					  this.menuItem33,
																					  this.menuItem21,
																					  this.menuItem29,
																					  this.menuItem22,
																					  this.menuItem23,
																					  this.menuItem24,
																					  this.menuItem25,
																					  this.menuItem26,
																					  this.menuItem30,
																					  this.menuItem27,
																					  this.menuItem32,
																					  this.menuItem31,
																					  this.menuItem4,
																					  this.menuItem6,
																					  this.menuItem34,
																					  this.menuItem35,
																					  this.menuItem38,
																					  this.menuItem8,
																					  this.menuItem7,
																					  this.menuItem5});
			this.menuItem1.Text = "DemoOptions";
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 0;
			this.menuItem2.Text = "XY Plot - Trig Functions";
			this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
			// 
			// menuItem28
			// 
			this.menuItem28.Index = 1;
			this.menuItem28.Text = "Stacked XY Plot";
			this.menuItem28.Click += new System.EventHandler(this.menuItem28_Click);
			// 
			// menuItem3
			// 
			this.menuItem3.Index = 2;
			this.menuItem3.Text = "Pie Charts";
			this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
			// 
			// menuItem20
			// 
			this.menuItem20.Index = 3;
			this.menuItem20.Text = "Bar Chart";
			this.menuItem20.Click += new System.EventHandler(this.menuItem20_Click);
			// 
			// menuItem33
			// 
			this.menuItem33.Index = 4;
			this.menuItem33.Text = "Stacked Bar Chart";
			this.menuItem33.Click += new System.EventHandler(this.menuItem33_Click);
			// 
			// menuItem21
			// 
			this.menuItem21.Index = 5;
			this.menuItem21.Text = "Area Chart - Trig Functions";
			this.menuItem21.Click += new System.EventHandler(this.menuItem21_Click);
			// 
			// menuItem29
			// 
			this.menuItem29.Index = 6;
			this.menuItem29.Text = "Stacked Area Chart";
			this.menuItem29.Click += new System.EventHandler(this.menuItem29_Click);
			// 
			// menuItem22
			// 
			this.menuItem22.Index = 7;
			this.menuItem22.Text = "Hi-Lo Chart";
			this.menuItem22.Click += new System.EventHandler(this.menuItem22_Click);
			// 
			// menuItem23
			// 
			this.menuItem23.Index = 8;
			this.menuItem23.Text = "Hi-Lo-Open-Close";
			this.menuItem23.Click += new System.EventHandler(this.menuItem23_Click);
			// 
			// menuItem24
			// 
			this.menuItem24.Index = 9;
			this.menuItem24.Text = "Bubble Chart";
			this.menuItem24.Click += new System.EventHandler(this.menuItem24_Click);
			// 
			// menuItem25
			// 
			this.menuItem25.Index = 10;
			this.menuItem25.Text = "Candle Chart";
			this.menuItem25.Click += new System.EventHandler(this.menuItem25_Click);
			// 
			// menuItem26
			// 
			this.menuItem26.Index = 11;
			this.menuItem26.Text = "Polar Chart";
			this.menuItem26.Click += new System.EventHandler(this.menuItem26_Click);
			// 
			// menuItem30
			// 
			this.menuItem30.Index = 12;
			this.menuItem30.Text = "Stacked Polar Chart";
			this.menuItem30.Click += new System.EventHandler(this.menuItem30_Click);
			// 
			// menuItem27
			// 
			this.menuItem27.Index = 13;
			this.menuItem27.Text = "Radar Chart";
			this.menuItem27.Click += new System.EventHandler(this.menuItem27_Click);
			// 
			// menuItem32
			// 
			this.menuItem32.Index = 14;
			this.menuItem32.Text = "Simple Stacked Radar Chart";
			this.menuItem32.Click += new System.EventHandler(this.menuItem32_Click);
			// 
			// menuItem31
			// 
			this.menuItem31.Index = 15;
			this.menuItem31.Text = "Stacked Radar Chart";
			this.menuItem31.Click += new System.EventHandler(this.menuItem31_Click);
			// 
			// menuItem4
			// 
			this.menuItem4.Index = 16;
			this.menuItem4.Text = "-";
			// 
			// menuItem6
			// 
			this.menuItem6.Index = 17;
			this.menuItem6.Text = "Reset C1Chart";
			this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
			// 
			// menuItem34
			// 
			this.menuItem34.Index = 18;
			this.menuItem34.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					   this.menuItem42,
																					   this.menuItem43});
			this.menuItem34.Text = "Save Chart Image";
			// 
			// menuItem42
			// 
			this.menuItem42.Index = 0;
			this.menuItem42.Text = "Save to file";
			this.menuItem42.Click += new System.EventHandler(this.menuItem42_Click);
			// 
			// menuItem43
			// 
			this.menuItem43.Index = 1;
			this.menuItem43.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					   this.menuItem44,
																					   this.menuItem45});
			this.menuItem43.Text = "Save to clipboard";
			// 
			// menuItem44
			// 
			this.menuItem44.Index = 0;
			this.menuItem44.Text = "as BMP";
			this.menuItem44.Click += new System.EventHandler(this.menuItem44_Click);
			// 
			// menuItem45
			// 
			this.menuItem45.Index = 1;
			this.menuItem45.Text = "as EMF";
			this.menuItem45.Click += new System.EventHandler(this.menuItem45_Click);
			// 
			// menuItem35
			// 
			this.menuItem35.Index = 19;
			this.menuItem35.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					   this.menuItem36,
																					   this.menuItem37});
			this.menuItem35.Text = "Save/Load Chart";
			// 
			// menuItem36
			// 
			this.menuItem36.Index = 0;
			this.menuItem36.Text = "Save to File";
			this.menuItem36.Click += new System.EventHandler(this.menuItem36_Click);
			// 
			// menuItem37
			// 
			this.menuItem37.Index = 1;
			this.menuItem37.Text = "Load from File";
			this.menuItem37.Click += new System.EventHandler(this.menuItem37_Click);
			// 
			// menuItem38
			// 
			this.menuItem38.Index = 20;
			this.menuItem38.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					   this.menuItem39,
																					   this.menuItem40});
			this.menuItem38.Text = "Save/Load Data";
			// 
			// menuItem39
			// 
			this.menuItem39.Index = 0;
			this.menuItem39.Text = "Save Data to File";
			this.menuItem39.Click += new System.EventHandler(this.menuItem39_Click);
			// 
			// menuItem40
			// 
			this.menuItem40.Index = 1;
			this.menuItem40.Text = "Load Data from File";
			this.menuItem40.Click += new System.EventHandler(this.menuItem40_Click);
			// 
			// menuItem8
			// 
			this.menuItem8.Index = 21;
			this.menuItem8.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem13,
																					  this.menuItem9,
																					  this.menuItem10,
																					  this.menuItem11,
																					  this.menuItem12,
																					  this.menuItem19});
			this.menuItem8.Text = "Print C1Chart";
			this.menuItem8.Click += new System.EventHandler(this.menuItem8_Click);
			// 
			// menuItem9
			// 
			this.menuItem9.Index = 1;
			this.menuItem9.Text = "ScaleToFit";
			this.menuItem9.Click += new System.EventHandler(this.menuItem9_Click);
			// 
			// menuItem7
			// 
			this.menuItem7.Index = 22;
			this.menuItem7.Text = "-";
			// 
			// menuItem5
			// 
			this.menuItem5.Index = 23;
			this.menuItem5.Text = "Exit";
			this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
			// 
			// menuItem41
			// 
			this.menuItem41.Index = 2;
			this.menuItem41.Text = "Properties";
			this.menuItem41.Click += new System.EventHandler(this.menuItem41_Click);
			// 
			// propertyGrid1
			// 
			this.propertyGrid1.CommandsVisibleIfAvailable = true;
			this.propertyGrid1.LargeButtons = false;
			this.propertyGrid1.LineColor = System.Drawing.SystemColors.ScrollBar;
			this.propertyGrid1.Location = new System.Drawing.Point(8, 16);
			this.propertyGrid1.Name = "propertyGrid1";
			this.propertyGrid1.Size = new System.Drawing.Size(304, 272);
			this.propertyGrid1.TabIndex = 0;
			this.propertyGrid1.Text = "propertyGrid1";
			this.propertyGrid1.ViewBackColor = System.Drawing.SystemColors.Window;
			this.propertyGrid1.ViewForeColor = System.Drawing.SystemColors.WindowText;
			// 
			// menuItem46
			// 
			this.menuItem46.Index = 3;
			this.menuItem46.Text = "Flash";
			this.menuItem46.Click += new System.EventHandler(this.menuItem46_Click);
			// 
			// FormChart2D
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(704, 401);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.C1Chart1,
																		  this.propertyGrid1});
			this.Menu = this.mainMenu1;
			this.Name = "FormChart2D";
			this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
			this.Text = "FormChart2D";
			this.Resize += new System.EventHandler(this.Form1_Resize);
			this.Load += new System.EventHandler(this.Form1_Load);
			((System.ComponentModel.ISupportInitialize)(this.C1Chart1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void _sizeControls()
		{
			this.propertyGrid1.Height = this.ClientSize.Height;
			this.C1Chart1.Left = this.propertyGrid1.Width;
			this.C1Chart1.Height = this.ClientSize.Height;
			this.C1Chart1.Width = this.ClientSize.Width - this.C1Chart1.Left;
		}

		private int _unique
		{
			get { m_unique++; return m_unique; }
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
			this.propertyGrid1.SelectedObject = this.C1Chart1;
			this.propertyGrid1.Text = this.C1Chart1.Name;
			this.propertyGrid1.Top = 0;
			this.propertyGrid1.Left = 0;
			this.C1Chart1.Top = 0;
			_sizeControls();
			this.menuItem17.Checked = C1Chart1.PrintDialogUsage;
			this.runTestProcedures();
			Debug.WriteLine("Chart AssemblyFileVersion: " + C1Chart1.AssemblyFileVersionString);
			Debug.WriteLine("Chart AssemblyVersion: " + C1Chart1.AssemblyVersionString);
		}

		private void Form1_Resize(object sender, System.EventArgs e)
		{
			_sizeControls();
		}

		private void Chart1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			if(e.Button == MouseButtons.Right)
			{
				Debug.WriteLine("Right Click X,Y Position = " + e.X.ToString() + "," + e.Y.ToString());
				ChartGroup grp = C1Chart1.ChartGroups.Group0;

				float xd=0f, yd=0f;
				if(grp.CoordToDataCoord(e.X, e.Y, ref xd, ref yd))
				{
					Debug.WriteLine("   DataCoord = " + xd.ToString() + "," + yd.ToString());
				}
			}
			else if(e.Button == MouseButtons.Middle)
			{
				Debug.WriteLine("Middle Click");

				// the floating labels, since constantly repainting
				// these labels will undo the drawing below.
				LabelsCollection lc = C1Chart1.ChartLabels.LabelsCollection;
				lc.Remove(lc[cInfoLabel + "0"]);
				lc.Remove(lc[cInfoLabel + "1"]);
				C1Chart1.Refresh();

				ChartGroup grp = C1Chart1.ChartGroups.Group0;
				int si=0, pi=0, ds=0;
				// find the nearest point.
				if(grp.CoordToDataIndex(e.X, e.Y, CoordinateFocusEnum.XandYCoord, ref si, ref pi, ref ds))
				{
					Rectangle r = grp.DataIndexToRect(si, pi);
					if(!r.IsEmpty)
					{
						Pen lpen = Pens.Black;
						Brush lbrush = Brushes.Black;

						if(grp.ChartType == Chart2DTypeEnum.Pie)
						{
							// pie charts a special case, where the
							// returned rectangle provides information
							// describing the pie slice, and not really
							// a rectangle.
							if(ds == 0)
							{
								int xp=0, yp=0;
								if(grp.DataIndexToCoord(si, pi, ref xp, ref yp))
								{
									xp -= r.Left;
									yp -= r.Top;

									int radius = (int)Math.Sqrt(xp*xp + yp*yp);
									int startAngle = r.Width;
									int sweepAngle = r.Height - r.Width;

									r.Width = 2 * radius;
									r.Height = 2 * radius;
									r.X -= radius;
									r.Y -= radius;

									Graphics g = C1Chart1.CreateGraphics();									
									g.DrawPie(lpen, r, startAngle, sweepAngle);
									g.FillPie(lbrush, r, startAngle, sweepAngle);
									g.Dispose();
								}
							}
						}
						else if(r.Contains(e.X, e.Y))
						{
							// if the nearest point rect contains the click point
							// draw and fill the rectangle the rectangle.
							Graphics g = C1Chart1.CreateGraphics();
							g.DrawRectangle(lpen,r);
							g.FillRectangle(lbrush,r);
							g.Dispose();
						}
					}
				}
			}
		}

		private void Chart1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			ChartRegionEnum region = C1Chart1.ChartRegionFromCoord(e.X, e.Y);
			Debug.WriteLine(_unique.ToString() + ") RegionCode: " + region.ToString());
			if(region == ChartRegionEnum.Legend)
			{
				int gi=0, si=0;
				if(C1Chart1.Legend.SeriesFromCoord(e.X, e.Y, ref gi, ref si))
				{
					string seriesName = C1Chart1.ChartGroups[gi].ChartData[si].Label;
					Debug.WriteLine("  gi=" + gi.ToString() + ", si=" + si.ToString() + 
						", SeriesName=" + seriesName);
				}
			}
			else if(region == ChartRegionEnum.ChartLabel)
			{
				int li=0;
				if(C1Chart1.ChartLabels.LabelFromCoord(e.X, e.Y, ref li))
				{
					C1.Win.C1Chart.Label lab = C1Chart1.ChartLabels[li];
					Debug.WriteLine(" LabelIndex=" + li.ToString() + ", LabelName=" + lab.Name);
				}
			}

			if(C1Chart1.Capture)
			{
				if(e.Button == MouseButtons.Left)
				{
					if(this.Cursor.Equals(Cursors.VSplit))
					{
						int newleft = C1Chart1.Left + e.X;
						propertyGrid1.Width = newleft-1;
						_sizeControls();
					}
				}
				else
				{
					if(e.X < -10 || e.X > 10)
					{
						// restore mouse cursor
						if(Cursor.Equals(Cursors.VSplit))
							this.Cursor = Cursors.Default;
					}
				}
			}
			else
			{
				if(e.X >= -10 && e.X <= 10)
				{
					// set mouse cursor
					if(!Cursor.Equals(Cursors.VSplit))
						this.Cursor = Cursors.VSplit;
				}
				else
				{
					// restore mouse cursor
					if(Cursor.Equals(Cursors.VSplit))
						this.Cursor = Cursors.Default;
				}

				for(int i=0; i < C1Chart1.ChartGroups.Count; i++)
				{
					ChartGroup grp = C1Chart1.ChartGroups[i];
					if(grp.ChartData.SeriesList.Count > 0)
					{
						float xd=0f, yd=0f;
						if(grp.CoordToDataCoord(e.X, e.Y, ref xd, ref yd))
						{
							C1.Win.C1Chart.Label l = C1Chart1.ChartLabels[cInfoLabel + i.ToString()];
							if(l != null)
							{
								int borderWidth = C1Chart1.Style.Border.Thickness;
								if(i==0)
									l.AttachMethodData.X = borderWidth;
								else
									l.AttachMethodData.X = C1Chart1.Width - borderWidth;

								l.AttachMethodData.Y = borderWidth;
								l.Text = "<<< " + l.Name + " >>>\n";
								l.Text += "Coord=(" + e.X.ToString() + "," + e.Y.ToString() + ")\n" +
									"  DataCoord=" + xd.ToString() + "," + yd.ToString() + ")\n";

								int xc=0, yc=0;
								grp.DataCoordToCoord(xd, yd, ref xc, ref yc);
								l.Text += "    Coord=(" + xc.ToString() + "," + yc.ToString() + ")\n";

								int s=0;
								int p=0;
								int dist=-1;
								grp.CoordToDataIndex(e.X, e.Y, CoordinateFocusEnum.XandYCoord, ref s, ref p, ref dist);
								//grp.CoordToDataIndex(e.X, e.Y, CoordinateFocusEnum.XCoord, ref s, ref p, ref dist);
								//grp.CoordToDataIndex(e.X, e.Y, CoordinateFocusEnum.YCoord, ref s, ref p, ref dist);
								l.Text += "  Series=" + s.ToString() + "(";
								if(s >= 0)
									l.Text += grp.ChartData.SeriesList[s].Label;
								else
									l.Text += "n/a";
								l.Text += ")  Point=" + p.ToString() + "   Distance=" + dist.ToString() + "\n";
				
								if(s >= 0 && p >= 0)
								{
									grp.DataIndexToCoord(s, p, ref xc, ref yc);
									l.Text += "    Coord=(" + xc.ToString() + "," + yc.ToString() + ")";

									PointF pf = (PointF)grp.ChartData.SeriesList[s].PointData[p];
									l.Text += "    DataValue(s,p)=" + pf.ToString() + "\n";

									if(	grp.ChartType == Chart2DTypeEnum.HiLo ||
										grp.ChartType == Chart2DTypeEnum.HiLoOpenClose ||
										grp.ChartType == Chart2DTypeEnum.Candle)
									{
										ChartDataSeries ser = grp.ChartData.SeriesList[s];
										float hi = (float)ser.Y[p];
										float lo = (float)ser.Y1[p];
										string adder = "    Hi=" + hi.ToString() + ", Lo=" + lo.ToString();
										if( grp.ChartType == Chart2DTypeEnum.HiLoOpenClose ||
											grp.ChartType == Chart2DTypeEnum.Candle)
										{
											hi = (float)ser.Y2[p];		// open
											lo = (float)ser.Y3[p];		// close
											adder += ", Open=" + hi.ToString() + ", Close=" + lo.ToString();
										}
										if(ser.X.DataType.Equals(typeof(DateTime)))
										{
											adder += ", Date=" + ((DateTime)ser.X[p]).ToShortDateString();
										}
										l.Text += adder + "\n";
									}
								}
								if(!l.Visible) l.Visible = true;
							}
						}
					}
				}
			}
		}

		private PointF [] makeSineCurveData(float phasor)
		{
			const int nPts = 42;
			double pi = System.Math.PI;

			PointF [] pts = (PointF[])Array.CreateInstance(typeof(PointF),nPts);

			double xi = (4.0 * pi) / (nPts-1);
			for(int i=0; i < nPts; i++)
			{
				double x = (double)i * xi;
				pts[i].X = (float)x;
				pts[i].Y = (float)Math.Sin(x + phasor);
			}

			return pts;
		}

		private void addInfoLabels()
		{
			// add a floating informational label that
			// will response to chart positioning
			C1.Win.C1Chart.Label l = C1Chart1.ChartLabels.LabelsCollection.AddNewLabel();
			l.Visible = false;
			l.Name = cInfoLabel + "0";
			l.Style.Font = new Font("Arial", 8);
			l.Style.HorizontalAlignment = AlignHorzEnum.Near;
			l.Style.BackColor = Color.FromKnownColor(KnownColor.Info);
			l.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			l.Style.Border.Color = Color.Red;
			l.Style.Border.Thickness = 1;
			l.AttachMethod = AttachMethodEnum.Coordinate;
			l.Compass = LabelCompassEnum.SouthEast;

			l = C1Chart1.ChartLabels.LabelsCollection.AddNewLabel();
			l.Visible = false;
			l.Name = cInfoLabel + "1";
			l.Style.Font = new Font("Arial", 8);
			l.Style.BackColor = Color.FromKnownColor(KnownColor.Info);
			l.Style.HorizontalAlignment = AlignHorzEnum.Far;
			l.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			l.Style.Border.Color = Color.Red;
			l.Style.Border.Thickness = 1;
			l.AttachMethod = AttachMethodEnum.Coordinate;
			l.Compass = LabelCompassEnum.SouthWest;
		}

		public void doRefresh()
		{
			propertyGrid1.Refresh();
		}

		public void runTestProceduresForXYPlot()
		{
			C1Chart1.Reset();

			// this is a dummy function that is used to modify
			// object properties during startup.  It is to be removed
			// later, if this application is ever used as a designer.
			C1Chart1.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			C1Chart1.Style.Border.Thickness = 5;

			C1.Win.C1Chart.Title lab = this.C1Chart1.Header;
			lab.Text = "This is the header";
			lab.Style.Font = new Font("Arial", 18, FontStyle.Bold);
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.RaisedBevel;
			lab.Style.Border.Thickness = 5;
			lab.Visible = true;

			lab = this.C1Chart1.Footer;
			lab.Text = "This is the footer";
			lab.Style.Font = new Font("Arial", 18, FontStyle.Bold);
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.RaisedBevel;
			lab.Style.Border.Thickness = 5;
			lab.Visible = true;

			C1.Win.C1Chart.Legend leg = this.C1Chart1.Legend;
			leg.Text = "Legend";
			leg.Style.Font = new Font("Arial", 10, FontStyle.Italic | FontStyle.Bold);
			leg.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.RaisedBevel;
			leg.Style.Border.Thickness = 8;
			leg.Visible = true;

			Area area = this.C1Chart1.ChartArea;
			area.Style.Font = new Font("Arial", 10, FontStyle.Italic | FontStyle.Bold);
			area.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.RaisedBevel;
			area.Style.Border.Thickness = 8;
			area.Visible = true;

			area.AxisX.Text = "The X-Axis";
			area.AxisY.Text = "The Y-Axis";
			area.AxisY2.Text = "The Y2-Axis";

			PointF [] ps;
			float pif = (float)System.Math.PI;

			ChartGroup group = C1Chart1.ChartGroups[0];
			ChartGroup group1 = C1Chart1.ChartGroups[1];
			group.ChartType = Chart2DTypeEnum.XYPlot;
			ChartData data = group.ChartData;

			ChartDataSeries s = new ChartDataSeries();
			data.SeriesList.Add(s);
			ps = this.makeSineCurveData(0.0F);
			ps[1].Y = hole_value;
			s.PointData.CopyDataIn(ps);
			s.LineStyle.Thickness = 1;
			s.FitType = FitTypeEnum.Line;

			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			ps = this.makeSineCurveData(pif/2);
			ps[10].X = hole_value;
			ps[11].Y = hole_value;
			s.PointData.CopyDataIn(ps);
			s.LineStyle.Thickness = 2;
			s.FitType = FitTypeEnum.Spline;

			s = new ChartDataSeries();
			ps = this.makeSineCurveData(pif);
			ps[22].Y = hole_value;
			s.PointData.CopyDataIn(ps);
			s.LineStyle.Thickness = 3;
			s.FitType = FitTypeEnum.Beziers;
			data.SeriesList.Add(s);

			s = new ChartDataSeries();
			ps = new PointF[] { PointF.Empty, new PointF((float)data.MaxX, 0f) };
			s.PointData.CopyDataIn(ps);
			s.LineStyle.Thickness = 2;
			data.SeriesList.Insert(0,s);

			s = data.SeriesList.AddNewSeries();
			ps = this.makeSineCurveData(pif/4);
			s.PointData.CopyDataIn(ps);
			s.LineStyle.Thickness = 7;

			s = data.SeriesList.AddNewSeries();
			ps = this.makeSineCurveData(2.445F);
			s.PointData.CopyDataIn(ps);
			s.LineStyle.Thickness = 7;
			s.FitType = FitTypeEnum.Spline;

			ChartLabels cLabs = C1Chart1.ChartLabels;
			cLabs.DefaultLabelStyle.BackColor = Color.Turquoise;
			cLabs.DefaultLabelStyle.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			cLabs.DefaultLabelStyle.Border.Thickness = 2;

			C1.Win.C1Chart.Label cLab = cLabs.LabelsCollection.AddNewLabel();
			cLab.Text = "This is a C1Chart Label\nSecond line of label";
			cLab.AttachMethod = AttachMethodEnum.DataIndex;
			cLab.AttachMethodData.GroupIndex = 0;
			cLab.AttachMethodData.SeriesIndex = 2;
			cLab.AttachMethodData.PointIndex = 3;
			cLab.Connected = true;
			cLab.Offset = 15;
			cLab.Visible = true;

			addInfoLabels();
			doRefresh();
		}

		public void runTestProceduresForStackedXYChart()
		{
			C1Chart1.Reset();

			// this is a dummy function that is used to modify
			// object properties during startup.  It is to be removed
			// later, if this application is ever used as a designer.
			C1Chart1.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			C1Chart1.Style.Border.Thickness = 5;

			C1.Win.C1Chart.Title lab = this.C1Chart1.Header;
			lab.Text = "Stacked XY Header";
			lab.Style.Font = new Font("Arial", 18, FontStyle.Bold);
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.RaisedBevel;
			lab.Style.Border.Thickness = 5;
			lab.Visible = true;

			lab = this.C1Chart1.Footer;
			lab.Text = "Stacked XY Footer";
			lab.Style.Font = new Font("Arial", 18, FontStyle.Bold);
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.RaisedBevel;
			lab.Style.Border.Thickness = 5;
			lab.Visible = true;

			C1.Win.C1Chart.Legend leg = this.C1Chart1.Legend;
			leg.Text = "Legend";
			leg.Style.Font = new Font("Arial", 10, FontStyle.Italic | FontStyle.Bold);
			leg.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.RaisedBevel;
			leg.Style.Border.Thickness = 8;
			leg.Visible = true;

			Area area = this.C1Chart1.ChartArea;
			area.Style.Font = new Font("Arial", 10, FontStyle.Italic | FontStyle.Bold);
			area.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.RaisedBevel;
			area.Style.Border.Thickness = 8;
			area.Visible = true;

			area.AxisX.Text = "The X-Axis";
			area.AxisX.GridMajor.Visible = true;
			area.AxisX.GridMajor.Color = Color.Black;
			area.AxisX.GridMinor.Visible = true;
			area.AxisX.GridMinor.Color = Color.DarkBlue;

			area.AxisY.Text = "The Y-Axis";
			area.AxisY.GridMajor.Visible = true;
			area.AxisY.GridMajor.Color = Color.Black;
			area.AxisY.GridMinor.Visible = true;
			area.AxisY.GridMinor.Color = Color.DarkBlue;

			ChartGroup group = C1Chart1.ChartGroups[0];
			group.ChartType = Chart2DTypeEnum.XYPlot;
			group.Stacked = true;

			ChartData data = group.ChartData;

			ChartDataSeries s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.FitType = FitTypeEnum.Line;
			PointF[] pfa = new PointF[]
				{
					new PointF(0.5f, 0.5f),
					new PointF(1f, 1.5f), 
					new PointF(1.5f, 3f),
					new PointF(1.6f, 3.5f),
					new PointF(1.8f, 1.5f),
				};
			s.PointData.CopyDataIn(pfa); 

			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.FitType = FitTypeEnum.Spline;
			pfa = new PointF[]
				{
					PointF.Empty,
					new PointF(0.5f, 1.2f),
					new PointF(1f, 1.2f), 
					new PointF(1.5f, 1.3f), 
					new PointF(2f, 4f)
				};
			s.PointData.CopyDataIn(pfa); 

			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.FitType = FitTypeEnum.Line;
			pfa = new PointF[]
				{
					new PointF(0f, 1.2f),
					new PointF(0.81f, 2f), 
					new PointF(1.5f, 3f), 
					new PointF(2f, 1f)
				};
			s.PointData.CopyDataIn(pfa); 

			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.FitType = FitTypeEnum.Spline;
			pfa = new PointF[]
				{
					new PointF(0f, 1.2f),
					new PointF(1f, 1f), 
					new PointF(1.5f, 0.3f), 
					new PointF(2f, 0.5f)
				};
			s.PointData.CopyDataIn(pfa); 

			ChartLabels cLabs = C1Chart1.ChartLabels;
			cLabs.DefaultLabelStyle.BackColor = Color.Turquoise;
			cLabs.DefaultLabelStyle.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			cLabs.DefaultLabelStyle.Border.Thickness = 2;

			C1.Win.C1Chart.Label cLab = cLabs.LabelsCollection.AddNewLabel();
			cLab.Text = "G=0,S=2,P=3";
			cLab.AttachMethod = AttachMethodEnum.DataIndex;
			cLab.AttachMethodData.GroupIndex = 0;
			cLab.AttachMethodData.SeriesIndex = 2;
			cLab.AttachMethodData.PointIndex = 3;
			cLab.Connected = true;
			cLab.Offset = 15;
			cLab.Visible = true;

			addInfoLabels();
			doRefresh();
		}

		public void runTestProceduresForStackedAreaChart()
		{
			runTestProceduresForStackedXYChart();
			ChartGroup grp = C1Chart1.ChartGroups[0];
			grp.ChartType = Chart2DTypeEnum.Area;
			grp.Stacked = true;

			C1Chart1.Header.Text = "Stacked Area Header";
			C1Chart1.Footer.Text = "Stacked Area Footer";
			doRefresh();
		}

		public void runTestProceduresForPieChart()
		{
			C1Chart1.Reset();
			C1Chart1.Style.Font = new Font("Arial", 18, FontStyle.Bold);

			C1.Win.C1Chart.Title lab = this.C1Chart1.Header;
			lab.Text = "Pie C1Chart";
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			lab.Style.Border.Thickness = 2;
			lab.Visible = true;

			lab = C1Chart1.Footer;
			lab.Text = "Pie Footer";
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			lab.Style.Border.Thickness = 2;
			lab.Visible = true;

			C1.Win.C1Chart.Legend leg = this.C1Chart1.Legend;
			leg.Text = "Legend";
			leg.Style.Font = new Font("Arial", 10, FontStyle.Italic | FontStyle.Bold);
			leg.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			leg.Style.Border.Thickness = 2;
			leg.Visible = true;

			Area area = this.C1Chart1.ChartArea;
			area.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.None;
			area.Style.BackColor = Color.Azure;
			area.Visible = true;

			ChartGroup group = C1Chart1.ChartGroups[0];
			group.ChartType = Chart2DTypeEnum.Pie;

			ChartData data = group.ChartData;

			ChartDataSeries s = new ChartDataSeries();
			data.SeriesList.Add(s);
			PointF [] ps;
			ps = new PointF[] { new PointF(1f,20f),
								new PointF(2f,24f),
								new PointF(3f, 42f),
								new PointF(4f, 13f),
								new PointF(5f, 10f)
							  };
			s.PointData.CopyDataIn(ps); 
			s.Offset = 30;

			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			ps = new PointF[] { new PointF(1f,20f),
								  new PointF(2f,24f),
								  new PointF(3f, 42f),
								  new PointF(4f, 13f),
								  new PointF(5f, 10f)
							  };
			s.PointData.CopyDataIn(ps); 

			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			ps = new PointF[] { new PointF(1f,10f),
								  new PointF(2f,4f),
								  new PointF(3f, 17f),
								  new PointF(4f, 81f),
								  new PointF(5f, 10f)
							  };
			s.PointData.CopyDataIn(ps); 
			s.Offset = 40;

			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			ps = new PointF[] { new PointF(1f, 20f),
								  new PointF(2f, 4f),
								  new PointF(3f, 52f),
								  new PointF(4f, 13f),
								  new PointF(5f, 10f)
							  };
			s.PointData.CopyDataIn(ps); 

			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			ps = new PointF[] { new PointF(1f,6f),
								  new PointF(2f,24f),
								  new PointF(3f, 142f),
								  new PointF(4f, 113),
								  new PointF(5f, 10f)
							  };
			s.PointData.CopyDataIn(ps); 

			ChartLabels cLabs = C1Chart1.ChartLabels;
			cLabs.DefaultLabelStyle.BackColor = Color.Turquoise;
			cLabs.DefaultLabelStyle.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			cLabs.DefaultLabelStyle.Border.Thickness = 3;

			C1.Win.C1Chart.Label cLab = cLabs.LabelsCollection.AddNewLabel();
			cLab.Text = "(0,0)";
			cLab.AttachMethod = AttachMethodEnum.DataIndex;
			cLab.AttachMethodData.GroupIndex = 0;
			cLab.AttachMethodData.SeriesIndex = 0;
			cLab.AttachMethodData.PointIndex = 0;
			cLab.Connected = true;
			cLab.Offset = 10;
			cLab.Visible = true;

			addInfoLabels();
			doRefresh();
		}

		public void runTestProceduresForBarChart()
		{
			C1Chart1.Reset();
			C1Chart1.Style.Font = new Font("Lucida Console", 18, FontStyle.Bold);

			C1.Win.C1Chart.Title lab = this.C1Chart1.Header;
			lab.Text = "Bar Chart";
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			lab.Style.Border.Thickness = 2;
			lab.Visible = true;

			lab = C1Chart1.Footer;
			lab.Text = "Bar Footer";
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			lab.Style.Border.Thickness = 2;
			lab.Visible = true;

			C1.Win.C1Chart.Legend leg = this.C1Chart1.Legend;
			leg.Text = "Legend";
			leg.Style.Font = new Font("Arial", 10, FontStyle.Italic | FontStyle.Bold);
			leg.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			leg.Style.Border.Thickness = 2;
			leg.Visible = true;

			Area area = this.C1Chart1.ChartArea;
			area.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.None;
			area.Style.BackColor = Color.Bisque;
			area.Visible = true;

			ChartGroup group = C1Chart1.ChartGroups[0];
			ChartGroup group2 = C1Chart1.ChartGroups[1];
			group.ChartType = Chart2DTypeEnum.Bar;

			ChartData data = group.ChartData;
			ChartData data2 = group2.ChartData;

			PointF [] ps;
			ps = new PointF[] { new PointF(5f,20f),
								  new PointF(4f,24f),
								  new PointF(3f, 42f),
								  new PointF(1f, 13f),
								  new PointF(2f, 10f)
							  };
			ChartDataSeries s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			s = new ChartDataSeries();
			data2.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			ps = new PointF[] { new PointF(1f,20f),
								  new PointF(2f,24f),
								  new PointF(3f, 42f),
								  new PointF(4f, 13f),
								  new PointF(5f, 10f)
							  };
			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			s = new ChartDataSeries();
			data2.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			ps = new PointF[] { new PointF(1f,10f),
								  new PointF(2f,4f),
								  new PointF(3f, 17f),
								  new PointF(4f, 81f),
								  new PointF(5f, 10f)
							  };
			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			s = new ChartDataSeries();
			data2.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			ps = new PointF[] { new PointF(1f, 20f),
								  new PointF(2f, 4f),
								  new PointF(3f, 52f),
								  new PointF(4f, 13f),
								  new PointF(5f, 10f)
							  };
			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			s = new ChartDataSeries();
			data2.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			ps = new PointF[] { new PointF(1f,6f),
								  new PointF(2f,24f),
								  new PointF(3f, 142f),
								  new PointF(4f, 113),
								  new PointF(5f, 10f)
							  };
			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			s = new ChartDataSeries();
			data2.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			ChartLabels cLabs = C1Chart1.ChartLabels;
			cLabs.DefaultLabelStyle.BackColor = Color.Turquoise;
			cLabs.DefaultLabelStyle.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			cLabs.DefaultLabelStyle.Border.Thickness = 3;

			C1.Win.C1Chart.Label cLab = cLabs.LabelsCollection.AddNewLabel();
			cLab.Text = "Bar Label";
			cLab.AttachMethod = AttachMethodEnum.DataIndex;
			cLab.AttachMethodData.GroupIndex = 0;
			cLab.AttachMethodData.SeriesIndex = 0;
			cLab.AttachMethodData.PointIndex = 0;
			cLab.Compass = LabelCompassEnum.North;
			cLab.Connected = true;
			cLab.Offset = 10;
			cLab.Visible = true;

			addInfoLabels();
			doRefresh();
		}

		public void runTestProceduresForStackedBarChart()
		{
			C1Chart1.Reset();
			C1Chart1.Style.Font = new Font("Lucida Console", 18, FontStyle.Bold);

			C1.Win.C1Chart.Title lab = this.C1Chart1.Header;
			lab.Text = "Stacked Bar Chart\nWith A Centered AlarmZone";
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			lab.Style.Border.Thickness = 2;
			lab.Visible = true;

			lab = C1Chart1.Footer;
			lab.Text = "Stacked Bar Footer";
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			lab.Style.Border.Thickness = 2;
			lab.Visible = true;

			C1.Win.C1Chart.Legend leg = this.C1Chart1.Legend;
			leg.Text = "SB Legend";
			leg.Style.Font = new Font("Arial", 10, FontStyle.Italic | FontStyle.Bold);
			leg.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			leg.Style.Border.Thickness = 2;
			leg.Visible = true;

			Area area = this.C1Chart1.ChartArea;
			area.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.None;
			area.Style.BackColor = Color.Bisque;
			area.Visible = true;

			area.AxisY.Min = 0;
			area.AxisY.GridMajor.Color = Color.Black;
			area.AxisY.GridMajor.Visible = true;
			area.AxisY.GridMinor.Visible = true;

			AlarmZone az = area.PlotArea.AlarmZones.AddNewZone();
			az.Name = "AlarmZoneForBar";
			az.BackColor = Color.CadetBlue;
			az.NearExtent = 1.5f;
			az.FarExtent = 4.5f;
			az.LowerExtent = 100f;
			az.UpperExtent = 200f;
			az.Visible = true;

			ChartGroup group = C1Chart1.ChartGroups[0];
			group.ChartType = Chart2DTypeEnum.Bar;
			group.Stacked = true;

			ChartData data = group.ChartData;
			PointF [] ps;
			ps = new PointF[] { new PointF(1f, 13f),
								  new PointF(2f, 10f),
								  new PointF(3f, 42f),
								  new PointF(4f,24f),
								  new PointF(5f,20f),
							  };
			ChartDataSeries s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			ps = new PointF[] { new PointF(1f,20f),
								  new PointF(2f,24f),
								  new PointF(3f, 42f),
								  new PointF(4f, 13f),
								  new PointF(5f, 10f)
							  };
			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			ps = new PointF[] { new PointF(1f,10f),
								  new PointF(2f,4f),
								  new PointF(3f, 17f),
								  new PointF(4f, 81f),
								  new PointF(5f, 10f)
							  };
			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			ps = new PointF[] { new PointF(1f, 20f),
								  new PointF(2f, 4f),
								  new PointF(3f, 52f),
								  new PointF(4f, 13f),
								  new PointF(5f, 10f)
							  };
			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			ps = new PointF[] { new PointF(1f,6f),
								  new PointF(2f,24f),
								  new PointF(3f, 142f),
								  new PointF(4f, 113),
								  new PointF(5f, 10f)
							  };

			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			ChartLabels cLabs = C1Chart1.ChartLabels;
			cLabs.DefaultLabelStyle.BackColor = Color.Turquoise;
			cLabs.DefaultLabelStyle.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			cLabs.DefaultLabelStyle.Border.Thickness = 3;

			C1.Win.C1Chart.Label cLab = cLabs.LabelsCollection.AddNewLabel();
			cLab.Text = "Stacked Bar Label";
			cLab.AttachMethod = AttachMethodEnum.DataIndex;
			cLab.AttachMethodData.GroupIndex = 0;
			cLab.AttachMethodData.SeriesIndex = 0;
			cLab.AttachMethodData.PointIndex = 0;
			cLab.Compass = LabelCompassEnum.North;
			cLab.Connected = true;
			cLab.Offset = 10;
			cLab.Visible = false;	//true;

			addInfoLabels();

			int sl = data.SeriesList.Count;
			int pl = ps.Length;

			float [,] xys = (float[,])Array.CreateInstance(typeof(float),sl+1,pl);
			xys.Initialize();

			// set the X values.
			for(int p=0; p < pl; p++)
				xys[0,p] = ps[p].X;

			Random rand = new Random(11);
			for(int si=0; si < sl; si++)
			{
				ps = (PointF[])data[si].PointData.CopyDataOut();
				for(int p0=0; p0 < pl; p0++)
					xys[si+1,p0] = ps[p0].Y;
			}

			dumpStackedArray(xys);
			doRefresh();
		}
		
		public void runTestProceduresForHiLoChart()
		{
			C1Chart1.Reset();
			C1Chart1.Style.Font = new Font("Lucida Console", 18, FontStyle.Bold);

			C1.Win.C1Chart.Title lab = this.C1Chart1.Header;
			lab.Text = "Hi-Lo Chart Header";
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			lab.Style.Border.Thickness = 2;
			lab.Visible = true;

			lab = C1Chart1.Footer;
			lab.Text = "Hi-Lo Chart Footer";
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			lab.Style.Border.Thickness = 2;
			lab.Visible = true;

			C1.Win.C1Chart.Legend leg = this.C1Chart1.Legend;
			leg.Text = "Legend";
			leg.Style.Font = new Font("Arial", 10, FontStyle.Italic | FontStyle.Bold);
			leg.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			leg.Style.Border.Thickness = 2;
			leg.Visible = true;

			Area area = this.C1Chart1.ChartArea;
			area.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.None;
			area.Style.BackColor = Color.AliceBlue;
			area.Visible = true;

			area.AxisX.GridMajor.Visible = true;
			area.AxisX.AnnoFormat = FormatEnum.DateManual;
			area.AxisX.AnnoFormatString = "MM/dd";
			area.AxisX.AnnotationRotation = 30;
			area.AxisX.Text = "Date of Interest";

			area.AxisY.GridMajor.Visible = true;
			area.AxisY.Text = "Price ($)";

			ChartGroup group = C1Chart1.ChartGroups[0];
			group.ChartType = Chart2DTypeEnum.HiLo;
			ChartData data = group.ChartData;

			DateTime [] Xds = new DateTime[] { new DateTime(2002,1,1), new DateTime(2002,1,2),
					new DateTime(2002,1,3), new DateTime(2002,1,4), new DateTime(2002,1,5) };
			float[] Hi = new float[] { 10f, 12f, 17f, 19f, 14f };
			float[] Lo = new float[] {  7f,  6f, 12f, 10f, 13f };

			ChartDataSeries s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.X.CopyDataIn(Xds);
			s.Y.CopyDataIn(Hi);
			s.Y1.CopyDataIn(Lo);
			s.LineStyle.Color = Color.Red;
			s.LineStyle.Thickness = 5;
			s.SymbolStyle.Size = 5;

			Hi = new float[] { 20f, 22f, 27f, 29f, 24f };
			Lo = new float[] { 17f, 16f, 22f, 20f, 23f };

			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.X.CopyDataIn(Xds);
			s.Y.CopyDataIn(Hi);
			s.Y1.CopyDataIn(Lo);

			s.LineStyle.Color = Color.Green;
			s.LineStyle.Thickness = 5;
			s.SymbolStyle.Size = 8;

			ChartLabels cLabs = C1Chart1.ChartLabels;
			cLabs.DefaultLabelStyle.BackColor = Color.Turquoise;
			cLabs.DefaultLabelStyle.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			cLabs.DefaultLabelStyle.Border.Thickness = 3;

			C1.Win.C1Chart.Label cLab = cLabs.LabelsCollection.AddNewLabel();
			cLab.Text = "Hi-Lo Label";
			cLab.AttachMethod = AttachMethodEnum.DataIndex;
			cLab.AttachMethodData.GroupIndex = 0;
			cLab.AttachMethodData.SeriesIndex = 0;
			cLab.AttachMethodData.PointIndex = 0;
			cLab.Compass = LabelCompassEnum.North;
			cLab.Connected = true;
			cLab.Offset = 10;
			cLab.Visible = true;

			addInfoLabels();
			doRefresh();
		}

		public void runTestProceduresForHiLoOpenCloseChart()
		{
			runTestProceduresForHiLoChart();

			ChartGroup cg = C1Chart1.ChartGroups[0];
			cg.ChartType = Chart2DTypeEnum.HiLoOpenClose;

			int ns = cg.ChartData.SeriesList.Count;
			for(int s=0; s < ns; s++)
			{
				ChartDataSeries ser = cg.ChartData.SeriesList[s];
				int np = ser.Length;

				float [] his = (float[])ser.Y.CopyDataOut();
				float [] los = (float[])ser.Y1.CopyDataOut();
				float [] opens = (float[])Array.CreateInstance(typeof(float),np);
				float [] closes = (float[])Array.CreateInstance(typeof(float),np);

				Random rnd = new Random(666);

				for(int p=0; p < np; p++)
				{
					// add in open and close points
					float hi = his[p];
					float lo = los[p];
					opens[p] = (float)(lo + (hi - lo) * rnd.NextDouble());
					closes[p] = (float)(lo + (hi - lo) * rnd.NextDouble());
				}
				ser.Y2.CopyDataIn(opens);
				ser.Y3.CopyDataIn(closes);
			}
			doRefresh();
		}

		public void runTestProceduresForBubbleChart()
		{
			this.runTestProceduresForHiLoChart();
			C1Chart1.ChartGroups[0].ChartType = Chart2DTypeEnum.Bubble;
			C1.Win.C1Chart.Label lab = C1Chart1.ChartLabels[0];
			lab.Text = "Bubble Label";
			lab.AttachMethodData.PointIndex = 3;
			lab.Compass = LabelCompassEnum.North;
			lab.Offset = 30;

			C1Chart1.Header.Text = "Bubble Header";
			C1Chart1.Footer.Text = "Bubble Footer";
			doRefresh();
		}

		public void runTestProceduresForAreaChart()
		{
			this.runTestProceduresForXYPlot();
			C1Chart1.ChartGroups[0].ChartType = Chart2DTypeEnum.Area;
			doRefresh();
		}

		public void runTestProceduresForCandleChart()
		{
			runTestProceduresForHiLoOpenCloseChart();

			ChartGroup cg = C1Chart1.ChartGroups[0];
			cg.ChartType = Chart2DTypeEnum.Candle;
			cg.HiLoData.FillTransparent = false;
			foreach(ChartDataSeries ser in cg.ChartData.SeriesList)
			{
				ser.LineStyle.Thickness = 1;
				ser.SymbolStyle.Size = 12;
				ser.SymbolStyle.Color = Color.Yellow;
			}

			C1.Win.C1Chart.Label lab = C1Chart1.ChartLabels[0];
			lab.Text = "Candle Label";
			lab.AttachMethodData.PointIndex = 3;
			lab.Compass = LabelCompassEnum.NorthEast;
			lab.Offset = 30;

			C1Chart1.Header.Text = "Candle Header";
			C1Chart1.Footer.Text = "Candle Footer";
			doRefresh();
		}

		public void runTestProceduresForPolarChart()
		{
			C1Chart1.Reset();
			C1Chart1.Style.Font = new Font("Lucida Console", 18, FontStyle.Bold);

			C1.Win.C1Chart.Title lab = this.C1Chart1.Header;
			lab.Text = "Polar Chart\nwith 2 AlarmZones";
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			lab.Style.Border.Thickness = 2;
			lab.Visible = true;

			lab = C1Chart1.Footer;
			lab.Text = "Polar Chart Footer";
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			lab.Style.Border.Thickness = 2;
			lab.Visible = true;

			C1.Win.C1Chart.Legend leg = this.C1Chart1.Legend;
			leg.Text = "Polar Legend";
			leg.Style.Font = new Font("Arial", 10, FontStyle.Italic | FontStyle.Bold);
			leg.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			leg.Style.Border.Thickness = 2;
			leg.Visible = true;

			Area area = this.C1Chart1.ChartArea;
			area.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.None;
			area.Style.BackColor = Color.Bisque;
			area.AxisX.Font = new Font("Lucida Console", 9);
			area.AxisX.Text = "Polar X Axis";
			area.AxisX.TickMajor = TickMarksEnum.Cross;
			area.AxisX.GridMajor.Visible = true;
			area.AxisY.GridMajor.Visible = true;
			area.AxisX.GridMinor.Visible = true;
			area.AxisY.GridMinor.Visible = true;
			area.AxisY.Font = new Font("Arial",9);
			area.Visible = true;
			area.PlotArea.BackColor = Color.Azure;

			AlarmZone az = area.PlotArea.AlarmZones.AddNewZone();
			az.LowerExtent = 0f;
			az.UpperExtent = 24f;
			az.NearExtent = 240f;
			az.FarExtent = 265f;
			az.BackColor = Color.Green;
			az.Visible = true;

			az = area.PlotArea.AlarmZones.AddNewZone();
			az.LowerExtent = 24f;
			az.UpperExtent = 34f;
			az.NearExtent = 120f;
			az.FarExtent = 150f;
			az.BackColor = Color.CadetBlue;
			az.Visible = true;

			ChartGroup group = C1Chart1.ChartGroups[0];
			group.ChartType = Chart2DTypeEnum.Polar;
			group.Polar.Degrees = true;

			ChartData data = group.ChartData;
			PointF [] ps;

			ps = new PointF[] { new PointF(30f,20f),
								  new PointF(60f,24f),
								  new PointF(90f, 42f),
								  new PointF(120f, 13f),
								  new PointF(150f, 10f)
							  };
			ChartDataSeries s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			ps = new PointF[] { new PointF(10f,20f),
								  new PointF(20f,24f),
								  new PointF(30f, 42f),
								  new PointF(40f, 13f),
								  new PointF(50f, 10f)
							  };
			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			ps = new PointF[] { new PointF(60f,10f),
								  new PointF(120f,4f),
								  new PointF(180f, 17f),
								  new PointF(240f, 18f),
								  new PointF(300f, 10f)
							  };
			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			ps = new PointF[] { new PointF(45f, 20f),
								  new PointF(90f, 4f),
								  new PointF(135f, 25f),
								  new PointF(180f, 13f),
								  new PointF(225f, 10f)
							  };
			s = new ChartDataSeries();
			data.SeriesList.Add(s);
			s.PointData.CopyDataIn(ps); 

			ChartLabels cLabs = C1Chart1.ChartLabels;
			cLabs.DefaultLabelStyle.BackColor = Color.Turquoise;
			cLabs.DefaultLabelStyle.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			cLabs.DefaultLabelStyle.Border.Thickness = 3;

			C1.Win.C1Chart.Label cLab = cLabs.LabelsCollection.AddNewLabel();
			cLab.Text = "Polar Label";
			cLab.AttachMethod = AttachMethodEnum.DataIndex;
			cLab.AttachMethodData.GroupIndex = 0;
			cLab.AttachMethodData.SeriesIndex = 0;
			cLab.AttachMethodData.PointIndex = 0;
			cLab.Compass = LabelCompassEnum.North;
			cLab.Connected = true;
			cLab.Offset = 10;
			cLab.Visible = true;

			addInfoLabels();
			doRefresh();
		}

		public void runTestProceduresForRadarChart()
		{
			this.runTestProceduresForPolarChart();

			C1Chart1.ChartGroups[0].ChartType = Chart2DTypeEnum.Radar;
			C1.Win.C1Chart.Label lab = C1Chart1.ChartLabels[0];
			lab.Text = "Radar Label";
			lab.AttachMethodData.PointIndex = 3;
			lab.Compass = LabelCompassEnum.North;
			lab.Offset = 30;

			C1Chart1.Header.Text = "Radar Header";
			C1Chart1.Footer.Text = "Radar Footer";
			C1Chart1.Legend.Text = "Radar Legend";
			C1Chart1.ChartArea.AxisX.Text = "Radar X Axis";
			doRefresh();
		}

		public void runTestProceduresForStackedPolarChart()
		{
			runTestProceduresForPolarChart();
			C1Chart1.ChartGroups[0].Stacked = true;
			C1Chart1.ChartLabels[0].Text = "Stacked Polar Label";

			C1Chart1.Header.Text = "Stacked Polar Header";
			C1Chart1.Footer.Text = "Stacked Polar Footer";
			C1Chart1.Legend.Text = "Stacked Polar Legend";
			doRefresh();
		}

		public void runTestProceduresForStackedRadarChart()
		{
			runTestProceduresForRadarChart();
			C1Chart1.ChartGroups[0].Stacked = true;
			C1Chart1.ChartLabels[0].Text = "Stacked Radar Label";
			C1Chart1.ChartLabels[0].Visible = false;

			C1Chart1.Header.Text = "Stacked Radar Header";
			C1Chart1.Footer.Text = "Stacked Radar Footer";
			C1Chart1.Legend.Text = "Stacked Radar Legend";
			doRefresh();
		}

		public void dumpStackedArray(float[,] xys)
		{
			int sl = xys.GetLength(0);
			int pl = xys.GetLength(1);
			int s;

			string ss1 = "     X ";
			string ss2 = "";
			for(s=0; s < sl-1; s++)
			{
				string ss = "Y" + s.ToString();
				while(ss.Length < 6)
					ss = " " + ss;
				ss1 += ss + "  ";

				ss = "SY" + s.ToString();
				while(ss.Length < 6)
					ss = " " + ss;
				ss2 += ss + "  ";
			}
			Debug.WriteLine(ss1 + ss2);

			ss2 = "";
			for(s=0; s < (2 * sl - 1); s++)
				ss2 += "------  ";
			Debug.WriteLine(ss2);

			for(int p=0; p < pl; p++)
			{
				for(s=0; s < sl; s++)
				{
					ss1 = xys[s,p].ToString("f2");
					while(ss1.Length < 6) ss1 = " " + ss1;
					Debug.Write(ss1 + "  ");
				}

				float sum=0f;
				for(s=1; s < sl; s++)
				{
					sum += xys[s,p];
					ss1 = sum.ToString("f2");
					while(ss1.Length < 6) ss1 = " " + ss1;
					Debug.Write(ss1 + "  ");
				}
				Debug.WriteLine("");
			}
		}

		public void runTestProceduresForSimpleStackedRadarChart()
		{
			C1Chart1.Reset();
			C1Chart1.Style.Font = new Font("Lucida Console", 18, FontStyle.Bold);

			C1.Win.C1Chart.Title lab = this.C1Chart1.Header;
			lab.Text = "Simple Stacked Radar Chart Header";
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			lab.Style.Border.Thickness = 2;
			lab.Visible = true;

			lab = C1Chart1.Footer;
			lab.Text = "Simple Stacked Radar Chart Footer";
			lab.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			lab.Style.Border.Thickness = 2;
			lab.Visible = true;

			C1.Win.C1Chart.Legend leg = this.C1Chart1.Legend;
			leg.Text = "Radar Legend";
			leg.Style.Font = new Font("Arial", 10, FontStyle.Italic | FontStyle.Bold);
			leg.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			leg.Style.Border.Thickness = 2;
			leg.Visible = true;

			Area area = this.C1Chart1.ChartArea;
			area.Style.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.None;
			area.Style.BackColor = Color.Bisque;
			area.AxisX.TickMajor = TickMarksEnum.Cross;
			area.AxisX.GridMajor.Visible = true;
			area.AxisY.GridMajor.Visible = true;
			area.AxisX.GridMinor.Visible = true;
			area.AxisY.GridMinor.Visible = true;
			area.AxisY.Font = new Font("Arial",9);
			area.AxisY.Min = 0f;
			area.Visible = true;

			area.PlotArea.BackColor = Color.Azure;

			ChartGroup group = C1Chart1.ChartGroups[0];
			group.ChartType = Chart2DTypeEnum.Radar;
			group.Stacked = true;
			group.Radar.Filled = true;

			ChartData data = group.ChartData;
			PointF [] ps;

			int sl = 4;
			int pl = 5;
			int p;

			ps = (PointF[])Array.CreateInstance(typeof(PointF),pl);

			float [,] xys = (float[,])Array.CreateInstance(typeof(float),sl+1,pl);
			xys.Initialize();

			// set the X values.
			for(p=0; p < pl; p++)
			{
				xys[0,p] = p;
				ps[p].X = p;
			}

			Random rand = new Random(11);
			for(int s=0; s < sl; s++)
			{
				for(p=0; p < pl; p++)
				{
					ps[p].Y = (float)(50 * rand.NextDouble() + 10);
					xys[s+1,p] = ps[p].Y;
				}

				ChartDataSeries ser = new ChartDataSeries();
				data.SeriesList.Add(ser);
				ser.PointData.CopyDataIn(ps); 
			}

			dumpStackedArray(xys);

			ChartLabels cLabs = C1Chart1.ChartLabels;
			cLabs.DefaultLabelStyle.BackColor = Color.Turquoise;
			cLabs.DefaultLabelStyle.Border.BorderStyle = C1.Win.C1Chart.BorderStyleEnum.Solid;
			cLabs.DefaultLabelStyle.Border.Thickness = 3;

			C1.Win.C1Chart.Label cLab = cLabs.LabelsCollection.AddNewLabel();
			cLab.Text = "Simple Stacked Radar Label";
			cLab.AttachMethod = AttachMethodEnum.DataIndex;
			cLab.AttachMethodData.GroupIndex = 0;
			cLab.AttachMethodData.SeriesIndex = 0;
			cLab.AttachMethodData.PointIndex = 0;
			cLab.Compass = LabelCompassEnum.North;
			cLab.Connected = true;
			cLab.Offset = 10;
			cLab.Visible = true;	//false;

			addInfoLabels();
			doRefresh();
		}

		public void runTestProcedures()
		{
			//this.runTestProceduresForXYPlot();
			//this.runTestProceduresForPieChart();
			//this.runTestProceduresForBarChart();
			//this.runTestProceduresForAreaChart();
			//this.runTestProceduresForHiLoChart();
			//this.runTestProceduresForBubbleChart();
			//this.runTestProceduresForCandleChart();
			//this.runTestProceduresForPolarChart();
			//this.runTestProceduresForRadarChart();
			//this.runTestProceduresForStackedXYChart();
			//this.runTestProceduresForStackedAreaChart();
			//this.runTestProceduresForStackedPolarChart();
			//this.runTestProceduresForStackedRadarChart();
			//this.runTestProceduresForSimpleStackedRadarChart();
			//this.runTestProceduresForStackedBarChart();
		}

		private void Chart1_BackColorChanged(object sender, System.EventArgs e)
		{
			Debug.WriteLine("BackColor has changed");
		}
		private void Chart1_ForeColorChanged(object sender, System.EventArgs e)
		{
			Debug.WriteLine("ForeColor has changed");
		}
		private void Chart1_FontChanged(object sender, System.EventArgs e)
		{
			Debug.WriteLine("Font has changed");
		}

		private void menuItem2_Click(object sender, System.EventArgs e)
		{
			this.runTestProceduresForXYPlot();
		}

		private void menuItem3_Click(object sender, System.EventArgs e)
		{
			this.runTestProceduresForPieChart();
		}

		private void menuItem20_Click(object sender, System.EventArgs e)
		{
			this.runTestProceduresForBarChart();
		}

		private void menuItem21_Click(object sender, System.EventArgs e)
		{
			this.runTestProceduresForAreaChart();
		}

		private void menuItem22_Click(object sender, System.EventArgs e)
		{
			this.runTestProceduresForHiLoChart();
		}

		private void menuItem23_Click(object sender, System.EventArgs e)
		{
			this.runTestProceduresForHiLoOpenCloseChart();
		}

		private void menuItem24_Click(object sender, System.EventArgs e)
		{
			this.runTestProceduresForBubbleChart();
		}

		private void menuItem25_Click(object sender, System.EventArgs e)
		{
			this.runTestProceduresForCandleChart();
		}

		private void menuItem26_Click(object sender, System.EventArgs e)
		{
			this.runTestProceduresForPolarChart();
		}

		private void menuItem27_Click(object sender, System.EventArgs e)
		{		
			this.runTestProceduresForRadarChart();
		}

		private void menuItem28_Click(object sender, System.EventArgs e)
		{
			this.runTestProceduresForStackedXYChart();
		}

		private void menuItem29_Click(object sender, System.EventArgs e)
		{		
			this.runTestProceduresForStackedAreaChart();
		}

		private void menuItem30_Click(object sender, System.EventArgs e)
		{
			this.runTestProceduresForStackedPolarChart();
		}

		private void menuItem31_Click(object sender, System.EventArgs e)
		{
			this.runTestProceduresForStackedRadarChart();
		}

		private void menuItem32_Click(object sender, System.EventArgs e)
		{
			this.runTestProceduresForSimpleStackedRadarChart();
		}

		private void menuItem33_Click(object sender, System.EventArgs e)
		{
			this.runTestProceduresForStackedBarChart();
		}

		private void menuItem5_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void menuItem6_Click(object sender, System.EventArgs e)
		{
			C1Chart1.Reset();
		}

		private void menuItem8_Click(object sender, System.EventArgs e)
		{
			C1Chart1.PrintChart();
		}

		private void menuItem9_Click(object sender, System.EventArgs e)
		{
			C1Chart1.PrintChart(PrintScaleEnum.ScaleToFit);
		}

		private void menuItem10_Click(object sender, System.EventArgs e)
		{
			C1Chart1.PrintChart(PrintScaleEnum.ScaleToHeight);
		}

		private void menuItem11_Click(object sender, System.EventArgs e)
		{
			C1Chart1.PrintChart(PrintScaleEnum.ScaleToMax);
		}

		private void menuItem12_Click(object sender, System.EventArgs e)
		{
			C1Chart1.PrintChart(PrintScaleEnum.ScaleToWidth);
		}

		private void menuItem13_Click(object sender, System.EventArgs e)
		{
			C1Chart1.PrintChart(PrintScaleEnum.ScaleNone);
		}

		private void menuItem15_Click(object sender, System.EventArgs e)
		{
			C1Chart1.PageSetup();
		}

		private void menuItem16_Click(object sender, System.EventArgs e)
		{
			C1Chart1.PrintSetup();
		}

		private void menuItem17_Click(object sender, System.EventArgs e)
		{
			bool usePrintDialog = C1Chart1.PrintDialogUsage;
			C1Chart1.PrintDialogUsage = !usePrintDialog;
			this.menuItem17.Checked = !usePrintDialog;
		}

		private void menuItem19_Click(object sender, System.EventArgs e)
		{
			C1Chart1.PrintChart();
		}

		
		private int lastFilterIndex = 1;
		private void menuItem34_Click(object sender, System.EventArgs e)
		{
		}

		private void menuItem36_Click(object sender, System.EventArgs e)
		{
			SaveFileDialog sfd = new SaveFileDialog();
			sfd.DefaultExt = "chart2dxml";
			sfd.FileName = "doc1";
			sfd.Filter = "Chart files(*.chart2dxml)|*.chart2dxml|All files (*.*)|*.*";
			
			DialogResult dr = sfd.ShowDialog();
			if(dr == DialogResult.OK)
				C1Chart1.SaveChartToFile(sfd.FileName);
		}

		private void menuItem37_Click(object sender, System.EventArgs e)
		{
			OpenFileDialog ofd = new OpenFileDialog();
			ofd.DefaultExt = "chart2dxml";
			ofd.FileName = "doc1";
			ofd.Filter = "Chart files(*.chart2dxml)|*.chart2dxml|All files (*.*)|*.*";

			DialogResult dr = ofd.ShowDialog();
			if(dr == DialogResult.OK)
				C1Chart1.LoadChartFromFile(ofd.FileName);

			doRefresh();
		}

		private void menuItem39_Click(object sender, System.EventArgs e)
		{
			SaveFileDialog sfd = new SaveFileDialog();
			sfd.DefaultExt = "datxml";
			sfd.FileName = "doc1";
			sfd.Filter = "Chart files(*.datxml)|*.datxml|All files (*.*)|*.*";
			
			DialogResult dr = sfd.ShowDialog();
			if(dr == DialogResult.OK)
				C1Chart1.ChartGroups[0].ChartData.SaveDataToFile(sfd.FileName);
		}

		private void menuItem40_Click(object sender, System.EventArgs e)
		{		
			OpenFileDialog ofd = new OpenFileDialog();
			ofd.DefaultExt = "datxml";
			ofd.FileName = "doc1";
			ofd.Filter = "Chart files(*.datxml)|*.datxml|All files (*.*)|*.*";

			DialogResult dr = ofd.ShowDialog();
			if(dr == DialogResult.OK)
				C1Chart1.ChartGroups[0].ChartData.LoadDataFromFile(ofd.FileName);

			doRefresh();
		}

		private void menuItem41_Click(object sender, System.EventArgs e)
		{
			C1Chart1.ShowProperties();
		
		}

		private void menuItem42_Click(object sender, System.EventArgs e)
		{
			// save to file
			SaveFileDialog sfg = new SaveFileDialog();

			sfg.Filter = "Metafiles (*.emf)|*.emf|" +
				"Bmp files (*.bmp)|*.bmp|" +
				"Gif files (*.gif)|*.gif|" +
				"Jpeg files (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
				"Png files (*.png)|*.png|" +
				"All graphic files (*.emf;*.bmp;*.gif;*.jpg;*.jpeg;*.png)|*.emf;*.bmp;*.gif;*.jpg;*.jpeg;*.png";
			sfg.FilterIndex = lastFilterIndex;
			sfg.OverwritePrompt = true;
			sfg.CheckPathExists = true;
			sfg.RestoreDirectory = false;
			sfg.ValidateNames = true;

			if(sfg.ShowDialog() == DialogResult.OK)
			{
				string fn = sfg.FileName;
				int indext = fn.LastIndexOf('.');
				if(indext < 0)
				{
					indext = fn.Length + 1;
					fn += ".emf";
				}
				else
					indext++;

				string ext = fn.Substring(indext);
				ImageFormat imgfmt = null;

				switch(ext)
				{
					case "emf":
						imgfmt = ImageFormat.Emf;
						C1Chart1.SaveImage(fn, imgfmt);
						break;

					case "bmp":
						imgfmt = ImageFormat.Bmp;
						break;

					case "gif":
						imgfmt = ImageFormat.Gif;
						break;

					case "jpeg":
					case "jpg":
						imgfmt = ImageFormat.Jpeg;
						break;

					case "png":
						imgfmt = ImageFormat.Png;
						break;

					default:
						return;
				}

				lastFilterIndex = sfg.FilterIndex;

				if(!imgfmt.Equals(ImageFormat.Emf))
				{
					Image img = C1Chart1.GetImage();
					img.Save(fn, imgfmt);
					img.Dispose();
				}
			}
			sfg.Dispose();
		}

		private void menuItem44_Click(object sender, System.EventArgs e)
		{
			// Save to Clipboard as bmp
			C1Chart1.SaveImage(ImageFormat.Bmp);
		}

		private void menuItem45_Click(object sender, System.EventArgs e)
		{
			// Save to Clipboard as emf
			C1Chart1.SaveImage(ImageFormat.Emf);
		}

		private void LaunchViewer(string filename)
		{
			try
			{
				System.Diagnostics.Process.Start(filename);
			}
			catch (Exception e)
			{
				System.Diagnostics.Process.Start("IEXPLORE.EXE", filename);
			}
		}

		private string tempdir = System.IO.Path.GetDirectoryName(Application.ExecutablePath);

		private void menuItem46_Click(object sender, System.EventArgs e)
		{
			Image image = this.C1Chart1.GetImage(ImageFormat.Emf);

			C1.C1Flash.C1FlashCanvas canvas = new C1.C1Flash.C1FlashCanvas();
			canvas.DrawImage(image, Point.Empty);
			canvas.RenderToFile(tempdir + @"\c1flash_canvas_c1chart.swf");
	
			LaunchViewer(tempdir + @"\c1flash_canvas_c1chart.swf");
		}
	}
}
