Scale my excel chart

D

DaveD170

Hi everybody,
I'm newbie in c# and I'm having trouble in creating an excel chart.
I have vector of data that my program calculated.
It's in the next format:
X Y
0.1 100
0.2 90
0.3 80
etc.

I assisted the article "How to automate Microsoft Excel from Microsoft
Visual C# .NET" and some other articles and was able to load this
values to the excel sheet. the X values inserted to A column and the Y
to B column.
My goal is to generate 2 different charts (xlXYScatterSmooth AND
xl3DColumn).

I have 2 problems -
1. The Scatter chart didn't work at all. I got exception on the
ChartWizard line.
the code was:
oRange = oSheet.get_Range("B2:B12", Missing.Value );
oChart.ChartWizard( oRange , Excel.XlChartType.xlXYScatterSmooth ,
Missing.Value,
Excel.XlRowCol.xlColumns, Missing.Value, Missing.Value,
Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value );


2. When I generated the xl3DColumn chart it worked fine BUT the scale
of the x axis was [0, 1] so I got graph with Y value = 100 and not
scaling at all.
I want my x axis will be [0.1 , 1]. How can I force the chart to use
the A column as it's scale?
The code is the same with one different - in the ChartWizard it's
xl3DColumn and not xlXYScatterSmooth .

Thank you very much
Dave
 

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