PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 5.00 average.

Adding noncontiguous ranges as series in xyscatter chart

 
 
Kristina Engdahl
Guest
Posts: n/a
 
      16th Aug 2004
Hi,
I'm trying to add data to a serie using Visual Basic for applications.
The data exist in noncontiguous ranges for both x-values and y-values.
I would like to add several series in this way and have tried the
following:

Dim newSerie As Series
Set newSerie = newChart.SeriesCollection.NewSeries
newSerie.Values = Union(yColumn, yCell)
newSerie.xValues = Union(xColumn, xCell)

I think the problem is that the ranges are noncontiguous but don't
understanf why it doesn't work. It is no problem to add data like this
by hand using the addSeries-function in the Chart-wizarard.

I have also tries the Extend function for the seriesCollection by
first sdding one range and then trying to extend with the other but
don't get how I can specify which serie the new data should be added
to.

I would much appreciate if someone could give me a hint on how to
solve this problem.

Regards,
Kristina
 
Reply With Quote
 
 
 
 
Jerry W. Lewis
Guest
Posts: n/a
 
      17th Aug 2004
Start with a contiguous area, then add on with .SeriesCollection.Extend
Try recording a macro while you do it manually.

Jerry

Kristina Engdahl wrote:

> Hi,
> I'm trying to add data to a serie using Visual Basic for applications.
> The data exist in noncontiguous ranges for both x-values and y-values.
> I would like to add several series in this way and have tried the
> following:
>
> Dim newSerie As Series
> Set newSerie = newChart.SeriesCollection.NewSeries
> newSerie.Values = Union(yColumn, yCell)
> newSerie.xValues = Union(xColumn, xCell)
>
> I think the problem is that the ranges are noncontiguous but don't
> understanf why it doesn't work. It is no problem to add data like this
> by hand using the addSeries-function in the Chart-wizarard.
>
> I have also tries the Extend function for the seriesCollection by
> first sdding one range and then trying to extend with the other but
> don't get how I can specify which serie the new data should be added
> to.
>
> I would much appreciate if someone could give me a hint on how to
> solve this problem.


 
Reply With Quote
 
Kristina Engdahl
Guest
Posts: n/a
 
      17th Aug 2004
Hi,
I still haven't been able to record a macro where I can see how I
define which serie that should get the new point. I used the addData
in the chart menu. When I do this all my data get in the first serie.
For example if I have three series and would like to add a single
datapoint to each serie all new data is added to the first serie.

Here is an example of code that does not work, I tried to order the
new data in xy-pairs before adding them to the seriescollection.
The "orignalData" holds ranges of about ten rows and the "newData" is
an array that have only single rows of data.

for i = 1 to 3
Dim newSerie As Series
Set newSerie = newChart.SeriesCollection.NewSeries
newSerie.xValues = orignalData(i).Columns(xColumn)
newSerie.Values = orignalData(i).Columns(yColumn)
next i

Dim rng As Range
Set rng = Union(newData(1).Columns(2), newData(1).Columns(3),
newData(2).Columns(2), newData(2).Columns(3), newData(3).Columns(2),
newData(3).Columns(3))

newChart.SeriesCollection.Extend Source:=rng, Rowcol:=xlRows,
CategoryLabels:=True

The only solution I can see now is to rearrange my data in to a new
table and this is not something that I would like to do.

Regards,
Kristina


"Jerry W. Lewis" <post_a_reply@no_e-mail.com> wrote in message news:<41215288.4010707@no_e-mail.com>...
> Start with a contiguous area, then add on with .SeriesCollection.Extend
> Try recording a macro while you do it manually.
>
> Jerry
>
> Kristina Engdahl wrote:
>
> > Hi,
> > I'm trying to add data to a serie using Visual Basic for applications.
> > The data exist in noncontiguous ranges for both x-values and y-values.
> > I would like to add several series in this way and have tried the
> > following:
> >
> > Dim newSerie As Series
> > Set newSerie = newChart.SeriesCollection.NewSeries
> > newSerie.Values = Union(yColumn, yCell)
> > newSerie.xValues = Union(xColumn, xCell)
> >
> > I think the problem is that the ranges are noncontiguous but don't
> > understanf why it doesn't work. It is no problem to add data like this
> > by hand using the addSeries-function in the Chart-wizarard.
> >
> > I have also tries the Extend function for the seriesCollection by
> > first sdding one range and then trying to extend with the other but
> > don't get how I can specify which serie the new data should be added
> > to.
> >
> > I would much appreciate if someone could give me a hint on how to
> > solve this problem.

 
Reply With Quote
 
Kristina Engdahl
Guest
Posts: n/a
 
      17th Aug 2004
Hi,
I still haven't been able to record a macro where I can see how I
define which serie that should get the new point. I used the addData
in the chart menu. When I do this all my data get in the first serie.
For example if I have three series and would like to add a single
datapoint to each serie all new data is added to the first serie.

Here is an example of code that does not work, I tried to order the
new data in xy-pairs before adding them to the seriescollection.
The "orignalData" holds ranges of about ten rows and the "newData" is
an array that have only single rows of data.

for i = 1 to 3
Dim newSerie As Series
Set newSerie = newChart.SeriesCollection.NewSeries
newSerie.xValues = orignalData(i).Columns(xColumn)
newSerie.Values = orignalData(i).Columns(yColumn)
next i

Dim rng As Range
Set rng = Union(newData(1).Columns(2), newData(1).Columns(3),
newData(2).Columns(2), newData(2).Columns(3), newData(3).Columns(2),
newData(3).Columns(3))

newChart.SeriesCollection.Extend Source:=rng, Rowcol:=xlRows,
CategoryLabels:=True

The only solution I can see now is to rearrange my data in to a new
table and this is not something that I would like to do.

Regards,
Kristina


"Jerry W. Lewis" <post_a_reply@no_e-mail.com> wrote in message news:<41215288.4010707@no_e-mail.com>...
> Start with a contiguous area, then add on with .SeriesCollection.Extend
> Try recording a macro while you do it manually.
>
> Jerry
>
> Kristina Engdahl wrote:
>
> > Hi,
> > I'm trying to add data to a serie using Visual Basic for applications.
> > The data exist in noncontiguous ranges for both x-values and y-values.
> > I would like to add several series in this way and have tried the
> > following:
> >
> > Dim newSerie As Series
> > Set newSerie = newChart.SeriesCollection.NewSeries
> > newSerie.Values = Union(yColumn, yCell)
> > newSerie.xValues = Union(xColumn, xCell)
> >
> > I think the problem is that the ranges are noncontiguous but don't
> > understanf why it doesn't work. It is no problem to add data like this
> > by hand using the addSeries-function in the Chart-wizarard.
> >
> > I have also tries the Extend function for the seriesCollection by
> > first sdding one range and then trying to extend with the other but
> > don't get how I can specify which serie the new data should be added
> > to.
> >
> > I would much appreciate if someone could give me a hint on how to
> > solve this problem.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying Named Ranges in Chart Series Revolvr Microsoft Excel Charting 1 18th Mar 2010 12:21 PM
Line Chart with multiple series that have different date ranges Rach7110 Microsoft Excel Charting 1 10th Oct 2008 05:35 PM
Adding custom XYscatter labels to Excel Chart from Access VBA dne Microsoft Access VBA Modules 2 12th Sep 2005 07:23 PM
Adding new series to chart with two series types =?Utf-8?B?QmlsbA==?= Microsoft Excel Charting 1 14th Nov 2004 07:43 PM
Excel2000: Is it possible to use named ranges as chart's series ranges Arvi Laanemets Microsoft Excel Misc 8 11th Jul 2004 06:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:07 AM.