472,121 Members | 1,430 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,121 software developers and data experts.

Scale my excel chart

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
2 6110
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
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.

Similar topics

13 posts views Thread by Allison Bailey | last post: by
1 post views Thread by Ben Halicki | last post: by
1 post views Thread by Randall Arnold | last post: by
reply views Thread by pmclinn | last post: by
6 posts views Thread by Thelma Lubkin | last post: by
9 posts views Thread by AGP | last post: by
1 post views Thread by Ally | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.