How to configure the MSGraph.Chart.8?

S

Simon

I am trying to insert a Graph.Chart into a word document using VS2005 C#. I
have got two series of test data for specimens one and two, respectively. The
data are about load-deflection pairs. Now I want to plot these two series of
test results on a chart to compare the difference between them; load in
x-axis and deflection in y-axis. I have filled four data series into
Chart.Datasheet as follows:
=======================
Curve for Specimen one:
Load: 0 1 2 3 4 5 6 7 8 9
Defl: 0 3 5 7 9 11 13 15 17
----------------------------------
Curve for Specimen two:
Load: 0 2 2.5 3 5 6.5 8 10
Def: 0 4.5 7 8 10 ...
=================
The codes I have completed look like this:

//Insert a chart.
Word.InlineShape oShape;
object oClassType = "MSGraph.Chart.8";
wrdRng = oDoc.Bookmarks.get_Item(ref oEndOfDoc).Range;
oShape = wrdRng.InlineShapes.AddOLEObject(ref oClassType, ref
oMissing,
ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing);

//Set the width of the chart.
oShape.Width = oWord.InchesToPoints(6.25f);
oShape.Height = oWord.InchesToPoints(3.57f);

object myChart = oShape.OLEFormat.Object;
(myChart as Graph.Chart).Application.DataSheet.Columns.Clear();
...(filling data series from here)
...

The first data row is the X_values by default. However, in this case, I need
to use different data series for the Deflection series.
Can anybody teach me how to do? In addition, how to show the caption of
x-axis in the chart?

Thanks!
 
S

Stefan Blom

You may want to try asking this in a newsgroup that deals with programming,
such as microsoft.public.word.vba.general.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top