- chartowc.zip
- ChartOWC
- demo.zip
- Debug
- AxInterop.SHDocVw.dll
- AxOWC10.dll
- ChartOWC.exe
- Interop.SHDocVw.dll
- MSComctlLib.dll
- OWC10.dll
|
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using OWC10;
using AxOWC10;
namespace ChartOWC
{
public class Form1 : System.Windows.Forms.Form
{
private ChartOWC.ChartSpace chartSpace1;
ChChart chchart;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton radioButtonSmothLine;
private System.Windows.Forms.RadioButton radioButtonArea;
private System.Windows.Forms.RadioButton radioButtonBar;
private System.Windows.Forms.RadioButton radioButtonLine;
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
InitChart();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.chartSpace1 = new ChartOWC.ChartSpace();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioButtonSmothLine = new System.Windows.Forms.RadioButton();
this.radioButtonArea = new System.Windows.Forms.RadioButton();
this.radioButtonBar = new System.Windows.Forms.RadioButton();
this.radioButtonLine = new System.Windows.Forms.RadioButton();
((System.ComponentModel.ISupportInitialize)(this.chartSpace1)).BeginInit();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// chartSpace1
//
this.chartSpace1.DataSource = null;
this.chartSpace1.Enabled = true;
this.chartSpace1.Location = new System.Drawing.Point(24, 8);
this.chartSpace1.Name = "chartSpace1";
this.chartSpace1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("chartSpace1.OcxState")));
this.chartSpace1.Size = new System.Drawing.Size(272, 176);
this.chartSpace1.TabIndex = 0;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.radioButtonSmothLine);
this.groupBox1.Controls.Add(this.radioButtonArea);
this.groupBox1.Controls.Add(this.radioButtonBar);
this.groupBox1.Controls.Add(this.radioButtonLine);
this.groupBox1.Location = new System.Drawing.Point(56, 200);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(192, 128);
this.groupBox1.TabIndex = 6;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Chart Type";
//
// radioButtonSmothLine
//
this.radioButtonSmothLine.Location = new System.Drawing.Point(24, 44);
this.radioButtonSmothLine.Name = "radioButtonSmothLine";
this.radioButtonSmothLine.Size = new System.Drawing.Size(152, 24);
this.radioButtonSmothLine.TabIndex = 8;
this.radioButtonSmothLine.Text = "Smoth Line";
this.radioButtonSmothLine.CheckedChanged +=new EventHandler(radioButtonSmothLine_CheckedChanged);
//
// radioButtonArea
//
this.radioButtonArea.Location = new System.Drawing.Point(24, 92);
this.radioButtonArea.Name = "radioButtonArea";
this.radioButtonArea.Size = new System.Drawing.Size(152, 24);
this.radioButtonArea.TabIndex = 7;
this.radioButtonArea.Text = "Area";
this.radioButtonArea.CheckedChanged +=new EventHandler(radioButtonArea_CheckedChanged);
//
// radioButtonBar
//
this.radioButtonBar.Location = new System.Drawing.Point(24, 68);
this.radioButtonBar.Name = "radioButtonBar";
this.radioButtonBar.Size = new System.Drawing.Size(152, 24);
this.radioButtonBar.TabIndex = 6;
this.radioButtonBar.Text = "Bar";
this.radioButtonBar.CheckedChanged +=new EventHandler(radioButtonBar_CheckedChanged);
//
// radioButtonLine
//
this.radioButtonLine.Checked = true;
this.radioButtonLine.Location = new System.Drawing.Point(24, 20);
this.radioButtonLine.Name = "radioButtonLine";
this.radioButtonLine.Size = new System.Drawing.Size(152, 24);
this.radioButtonLine.TabIndex = 5;
this.radioButtonLine.TabStop = true;
this.radioButtonLine.Text = "Line";
this.radioButtonLine.CheckedChanged += new System.EventHandler(this.radioButtonLine_CheckedChanged);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(336, 350);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.chartSpace1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.chartSpace1)).EndInit();
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void InitChart()
{
chartSpace1.ChartLayout = OWC10.ChartChartLayoutEnum.chChartLayoutHorizontal;
chchart = chartSpace1.Charts.Add (0);
chchart.HasTitle = true;
chchart.Title.Caption= "My Chart";
chchart.Type = OWC10.ChartChartTypeEnum.chChartTypeLine;
chchart.Axes[0].HasTitle = true;
chchart.Axes[0].Title.Caption = "X - Axis";
chchart.Axes[0].Scaling.Maximum = 10;
chchart.Axes[0].Scaling.Minimum = 0;
chchart.Axes[1].HasTitle = true;
chchart.Axes[1].Title.Caption = "Y - Axis";
chchart.Axes [1].Scaling .Maximum = 10;
chchart.Axes [1].Scaling .Minimum = 0;
string strSeriesName = "My Series";
string strCategory = "1,2,3,4,5";
string strValue = "3,8,2,8,4";
//Add a series to the chart�s series collection
ChSeries series = chchart.SeriesCollection.Add(0);
//Give the name of the series
chchart.SeriesCollection[0].SetData (OWC10.ChartDimensionsEnum.chDimSeriesNames, (int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, strSeriesName);
//Give the Categories
chchart.SeriesCollection[0].SetData (OWC10.ChartDimensionsEnum.chDimCategories, (int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, strCategory);
//Give The values
chchart.SeriesCollection[0].SetData (OWC10.ChartDimensionsEnum.chDimValues, (int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, strValue);
series.Line.set_Weight(OWC10.LineWeightEnum.owcLineWeightHairline );
series.Marker.Style = ChartMarkerStyleEnum.chMarkerStyleNone;
}
private void radioButtonLine_CheckedChanged(object sender, System.EventArgs e)
{
if(radioButtonLine.Checked)
{
chchart.Type = OWC10.ChartChartTypeEnum.chChartTypeLine;
}
}
private void radioButtonBar_CheckedChanged(object sender, System.EventArgs e)
{
if(radioButtonBar.Checked)
{
chchart.Type = OWC10.ChartChartTypeEnum.chChartTypeBarStacked;
}
}
private void radioButtonArea_CheckedChanged(object sender, System.EventArgs e)
{
if(radioButtonArea.Checked)
{
chchart.Type = OWC10.ChartChartTypeEnum.chChartTypeArea;
}
}
private void radioButtonSmothLine_CheckedChanged(object sender, System.EventArgs e)
{
if(radioButtonSmothLine.Checked)
{
chchart.Type = OWC10.ChartChartTypeEnum.chChartTypeSmoothLine;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am a software engineer working in Blr, india.
working in c++, vc++, mfc, c#.Net, COM/ATL.