I want two series using same X Axis and different Y Axis in scatter chart

P

Philip.Arbin

I want to plot two serieses of data on a SCATTER chart, with OWC, the X Axis
is presenting time, and I want the two serieses of data using different Y
Axises, of course same X Axis.
But when I ungroup the two serieses, the second one does not fit in the
original X Axis.
How can I group the two serieses on X Axis and ungroup them on Y Axis?

You know there is a lot of difference when you use SCATTER chart.
 
P

Peter Huang [MSFT]

Hi

I think you may take a look at the link below.
How To Create a Combination Chart Using the Office XP Chart Component or
the Office 2003 Chart Component
http://support.microsoft.com/kb/286211/

It will create a Line chart and a Column chart in the meantime with same X
values.
But you can change them all to line.
'Add a series of type Column.
Set oSeries1 = oChart.SeriesCollection.Add
oSeries1.Caption = "Sales"
oSeries1.SetData oConst.chDimCategories, oConst.chDataLiteral, _
Array("A", "B", "C", "D")
oSeries1.SetData oConst.chDimValues, oConst.chDataLiteral, _
Array(5000, 6025, 5575, 5900)
oSeries1.Type = oConst.chChartTypeLine

'Add a second series of type Line.
Set oSeries2 = oChart.SeriesCollection.Add
oSeries2.Caption = "Discount"
oSeries2.SetData oConst.chDimCategories, oConst.chDataLiteral, _
Array("A", "B", "C", "D")
oSeries2.SetData oConst.chDimValues, oConst.chDataLiteral, _
Array(0.1, 0.2, 0.1, 0.15)
oSeries2.Type = oConst.chChartTypeLine

You may have a try to see if that is what you want

Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Philip.Arbin

Hi,

Your solution does not work for me.
I think I should describe it clearly.

I am using the chart type of "SCATTER",
SCATTER is very different from LINE.

When you ungroup two serieses, they will use different "Value" Axises, but
same "Categories" Axis.
But in SCATTER chart, there is no "Categories" Data then no "Categories"
Axis.
Both X Value and Y Value in SCATTER chart are Value Data.
So X Axis and Y Axis are all "Value" Axises.
When you ungroup two serieses in SCATTER chart, they will use different
"Value" Axises, that is to say, they will use different X Axises AND
different Y Axises.

Let me show data to explain.

Data in two LINE data may be:
=====================
Line 1 :
------------------------------------------
Categories :
("A", "B", "C", "D")
Values :
(5000, 6025, 5575, 5900)
=====================
Line 2 :
------------------------------------------
Categories :
("A", "B", "C", "D")
Values :
(5000, 6025, 5575, 5900)
=====================

The two LINE serieses have their "Categories" data completely the same.

Data in two SCATTER data may be:
=====================
Scatter 1 :
------------------------------------------
X Values :
(12, 43, 52, 75)
Y Values :
(5000, 6025, 5575, 5900)
=====================
Scatter 2 :
------------------------------------------
X Values :
(14, 33, 57, 74)
Y Values :
(50, 65, 75, 59)
=====================

You see, two scatter serieses have DIFFERENT X Value data.

In another way, I may want to have tow serieses in SCATTER chart to have
same Y Axis and differet X Axis. :p

I think I should synchronize the scale of two serieses in X Value to solve
this issue.
 
P

Peter Huang [MSFT]

Hi Philip,

Yes, I agree with you, you may try the code below.
Private Sub Form_Load()
Dim ct As ChChart
Set ct = ChartSpace1.Charts.Add
ct.Type = chChartTypeScatterMarkers
Dim XArray
XArray = Array(1, 2, 3)
Dim s1 As ChSeries
Set s1 = ct.SeriesCollection.Add
s1.Caption = "Series1"
s1.SetData chDimXValues, chDataLiteral, XArray
s1.SetData chDimYValues, chDataLiteral, Array(2, 4, 6)
Dim s2 As ChSeries
Set s2 = ct.SeriesCollection.Add
s2.Caption = "Series2"
s2.SetData chDimXValues, chDataLiteral, XArray
s2.SetData chDimYValues, chDataLiteral, Array(3, 6, 9)
End Sub



Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Y

Yan-Hong Huang[MSFT]

Hello Philip,

I am reviewing the issue thread. Is the problem resolved? If you have any
more concerns, please feel free to reply here and we will follow up.

Thanks very much.

Sincerely,
Yanhong Huang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Philip.Arbin

Hi, guys,

I have not solve the problem yet.

What i want to do is to use same X axis and different Y axises for two
scatter line serieses in a chart, with OWC.

And I want to show the two Y axises on left side and right side of the
chart.

But when I "ungroup" the two serieses, the two serieses will use not only
different Y axises but also different X axises.

( both X axis and Y axis in scatter chart are "value axis", there is no
"catagory axis" in scatter chart. )

I think OWC works the same way as the chart in Excel works.

I can make it work in Excel this way:

select chart -> select series -> select series 2 -> Format Data Series ->
Axis - > Plot Series on -> Secondary axis

That's exactly what I want.

There is a way in chart in Excel then there must be a way in OWC.

Now I think OWC is good at "chart", and what I want is not a "chart" but a
"wave graph", maybe I should look for some "wave graph" component instead.

( can I post Chinese in this group? there is no responding Chinese group for
office component in msdn newsgroup)
 
A

Alvin Bruney

If you need control of the rendering process, you may want to take advantage
of custom drawing in the OWC. With custom drawing, you can draw whatever you
want on the chart surface, wave, sine curves etc. Here's a 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
 
Y

Yan-Hong Huang[MSFT]

Hi Philip,

Besides the technical information provided by Alvin, I am sorry to mention
that the managed newsgroups for MSDN subscribers are currently only
available in English. There is no Chinese support so far. For details about
MSDN subsciber support, please visit the following link:
http://msdn.microsoft.com/subscriptions/faq/#support

Thanks very much for your understanding.

Sincerely,
Yanhong Huang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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