2 y axis one on the left and the other on the right

M

Mithil

Hi everyone,
I was wondering whether someone could help me out
with this I have to plot two different data values of yaxis with the
same value of xaxis. For example I need to plot the percentages of
sales for that week and also number of products sold for that week in
the same chart. So there are 2 values of yaxis can anyone plz help me
with this. thanking you.

regards,
Mithil
 
A

Alvin Bruney [MVP]

You could use two series, that would provide to lines with the same y-axis.
I think it is cleaner this way and less confusing. If your requirement is to
see to y axes - you can resort to custom drawing to impose another axis.
Here's a custom drawing link
http://support.microsoft.com/default.aspx?scid=kb;en-us;555162

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
 
J

jtoswald

I just figured out how to do this yesterday, You need to make two
series. Then create a new axis based on the data in series two. Then
use the ungroup command on the second series. Then set this axis to
the right side.

Ill paste some code, maybe you can figure it out from that:

objSeries.SetData c.chDimXValues, c.chDataLiteral, xvalues
objSeries.SetData c.chDimYValues, c.chDataLiteral, yvalues

objSeries2.SetData c.chDimXValues, c.chDataLiteral, xvalues2
objSeries2.SetData c.chDimYValues, c.chDataLiteral, yvalues2

objSeries2.Ungroup True

Set objAxis = objChart.Axes.Add(objSeries2.Scalings(chDimYValues))

objAxis.Scaling.Maximum = 50
objAxis.Scaling.Minimum = 0
objAxis.Position = chAxisPositionRight

objChart.Axes(0).Scaling.Maximum = 200
objChart.Axes(0).Scaling.Minimum = 0

objChart.Axes(1).Scaling.Minimum = 0
objChart.Axes(1).Scaling.Maximum = 366

I didn't include everything, but that should give you an idea.
This creates a graph with a scale of 0-200 on the left, 0-50 on the
right and 0-366 on the bottom. Good luck.
 
S

Stin

I just noticed, to keep the same x axis you will have to rescale the
second series as well. I think the ungroup seperates it from the
default x axis.

objSeries2.Scalings(chDimXValues).Maximum = 366

is what I used
 

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