By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,089 Members | 2,069 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,089 IT Pros & Developers. It's quick & easy.

Scale my excel chart

P: n/a
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
Aug 19 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Tue, 19 Aug 2008 01:41:31 -0700, <Da******@gmail.comwrote:
Hi everybody,
I'm newbie in c# and I'm having trouble in creating an excel chart.
For what it's worth, your question isn't so much a C# question as it is an
Excel question (albeit automation). For best results and any serious hope
of a useful answer, you will be much better off finding a newsgroup
specific to Excel automation.

That said, with regards to your questions...
[...]
1. The Scatter chart didn't work at all. I got exception on the
ChartWizard line.
What exception? You always need to post the exact information about the
exception. What's the type? What's the message?
[...]
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?
I don't really know what you mean by "use the A column as it's [sic]
scale", but...you might consider setting the scale for the axes as desired
after creating the chart. Just set the appropriate properties as needed
on the axis object returned by the appropriate chart property (or method,
I can't recall now whether the axes are exposed as properties or not).

Pete
Aug 19 '08 #2

P: n/a
On Aug 19, 6:51*pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
On Tue, 19 Aug 2008 01:41:31 -0700, <DaveD...@gmail.comwrote:
Hi everybody,
I'm newbie in c# and I'm having trouble in creating an excel chart.

For what it's worth, your question isn't so much a C# question as it is an *
Excel question (albeit automation). *For best results and any serious hope *
of a useful answer, you will be much better off finding a newsgroup *
specific to Excel automation.

That said, with regards to your questions...
[...]
1. The Scatter chart didn't work at all. I got exception on the
ChartWizard line.

What exception? *You always need to post the exact information about the *
exception. *What's the type? *What's the message?
[...]
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?

I don't really know what you mean by "use the A column as it's [sic] *
scale", but...you might consider setting the scale for the axes as desired *
after creating the chart. *Just set the appropriate properties as needed *
on the axis object returned by the appropriate chart property (or method,*
I can't recall now whether the axes are exposed as properties or not).

Pete
Thank you Pete. I will post my question (with your good comments) in
the Excel group.
Aug 20 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.