Click here to Skip to main content
15,867,860 members
Articles / Programming Languages / C#
Article

Simple Charts Using OWC (Office Web Component)

Rate me:
Please Sign up or sign in to vote.
3.94/5 (9 votes)
1 Feb 2006 121.5K   3.6K   22   9
An article on Simple Chart Representation Using OWC

Sample Image

Introduction

This is a simple project for beginners to get some knowledge about using OWC in a C#.NET application for chart representation.

Background

Office 2003 Web Components do not provide event handling by default. We need to do some alterations. Kindly follow this link to get more information: Handle Events for the Office 2003 Web Components in Visual Studio .NET.

Using the code

After we convert OWC for event handling, we can add a reference to our project.

Steps

  1. Create a OWC Chart.
  2. Add the required number of chart series in it.
  3. Give the values for each chart series.
  4. Customize your chart to display it in the format you wish.
C#
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);

Points of Interest

I hope you've enjoyed this little tutorial. In future, I will provide you lot more stuff. And I am expecting your valuable suggestions.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior)
India India
I am a software engineer working in Blr, india.
working in c++, vc++, mfc, c#.Net, COM/ATL.


Comments and Discussions

 
QuestionHow can i use this pie of code in csharp application form [modified] Pin
huynhdangthai8-Jul-10 18:34
huynhdangthai8-Jul-10 18:34 
Questionin vb6 Pin
deepakmathur11-Dec-08 20:45
deepakmathur11-Dec-08 20:45 
GeneralCode Unavailable Pin
sysengineer14-Mar-08 23:47
sysengineer14-Mar-08 23:47 
GeneralOWC scatter chart error Pin
ganesh_india13-Jun-07 3:24
ganesh_india13-Jun-07 3:24 
Generaldynamically add Pin
superda15-Apr-07 21:16
superda15-Apr-07 21:16 
GeneralOpenOffice (Chart) Pin
timbits21414-Apr-07 10:58
timbits21414-Apr-07 10:58 
QuestionHandling click events on the chart Pin
nasubh19-Dec-06 1:56
nasubh19-Dec-06 1:56 
QuestionHow to draw series from 0,0 origine. Pin
Himadri Majumdar23-Nov-06 18:00
Himadri Majumdar23-Nov-06 18:00 
Hi,

Good job done.

I have one clarification, can I draw the graph from 0,0 location, as it's starting from first element of the category.

Will be great help if anyone could able to reply on this.

Thanks,

Himadri
GeneralUsing with ASP.Net Pin
Mohamed El Gohary23-May-06 23:31
Mohamed El Gohary23-May-06 23:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.