Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default .Chart.SeriesCollection.NewSeries.Values

I loop through the following code to populate a 1D array (Series4Array) from
one of two different 2D arrays (HistDB8 or HistDB9).

If ChartToggle = True Then
ReDim Series4Array(UBound(HistDB8, 1) - 1) 'total percent
For ii& = LBound(HistDB8, 1) + 1 To UBound(HistDB8, 1)
For jj& = LBound(HistDB8, 2) + 1 To UBound(HistDB8, 2)
If ThisDG = HistDB8(1, jj&) Then
Series4Array(ii& - 1) = Round(HistDB8(ii&, jj&), 4)
End If
Next jj&
Next ii&
Else
ReDim Series4Array(UBound(HistDB9, 1) - 1) 'total cost
For ii& = LBound(HistDB9, 1) + 1 To UBound(HistDB9, 1)
For jj& = LBound(HistDB9, 2) + 1 To UBound(HistDB9, 2)
If ThisDG = HistDB9(1, jj&) Then
Series4Array(ii& - 1) = HistDB9(ii&, jj&)
End If
Next jj&
Next ii&
End If

I then use the 1D array (and three others) to initialize values in separate
chart SeriesCollections. I loop through the following code to create one
total percent chart and one total cost chart for a few dozen configurations.

With ActiveSheet.ChartObjects.Add _
(Left:=MonChPosL, Width:=MonChPosW, Top:=MonChPosT, Height:=MonChPosH)

.Chart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:="Line -
Column on 2 Axes"

With .Chart.SeriesCollection.NewSeries
.Values = Series1Array
.XValues = SeriesXValuesArray
.ChartType = xlColumnStacked
End With
With .Chart.SeriesCollection.NewSeries
.Values = Series2Array
.ChartType = xlColumnStacked
End With
With .Chart.SeriesCollection.NewSeries
.Values = Series3Array
.ChartType = xlColumnStacked
End With
With .Chart.SeriesCollection.NewSeries
.Values = Series4Array
.ChartType = xlLineMarkers
.AxisGroup = 2
End With

....
....
....

End With


My problem is the values of the fourth SeriesCollection is always a set of
zeros when Series4Array is taken from HistDB9 but not when its taken from
HistDB8. The strange thing is I get no runtime errors.

I've embedded a msgbox and confirmed that Series4Array is good.

With .Chart.SeriesCollection.NewSeries

If ChartToggle = False Then
For ii& = LBound(Series4Array) To UBound(Series4Array)
MsgBox "DG = " & ThisDG & "; Series4Array(" & ii& & ") = " &
Series4Array(ii&)
Next ii&
End If

.Values = Series4Array
.ChartType = xlLineMarkers
.AxisGroup = 2
End With

Any help will be greatly appreciated.

Thanks much.


Kevin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default .Chart.SeriesCollection.NewSeries.Values

Problem solved!

I changed the ChartToggle switch around to see if the problem was with the
source data; changed the first line below to:

If ChartToggle = False Then

The result was that the percent data presented in the cost chart. But still
no cost data in the other chart.

So I went to the source of the cost data (an Access table) and changed the
data type from currency to Number (Long Integer). And voila!

So it goes.


Kevin


I wrote:

I loop through the following code to populate a 1D array (Series4Array) from
one of two different 2D arrays (HistDB8 or HistDB9).

If ChartToggle = True Then
ReDim Series4Array(UBound(HistDB8, 1) - 1) 'total percent
For ii& = LBound(HistDB8, 1) + 1 To UBound(HistDB8, 1)
For jj& = LBound(HistDB8, 2) + 1 To UBound(HistDB8, 2)
If ThisDG = HistDB8(1, jj&) Then
Series4Array(ii& - 1) = Round(HistDB8(ii&, jj&), 4)
End If
Next jj&
Next ii&
Else
ReDim Series4Array(UBound(HistDB9, 1) - 1) 'total cost
For ii& = LBound(HistDB9, 1) + 1 To UBound(HistDB9, 1)
For jj& = LBound(HistDB9, 2) + 1 To UBound(HistDB9, 2)
If ThisDG = HistDB9(1, jj&) Then
Series4Array(ii& - 1) = HistDB9(ii&, jj&)
End If
Next jj&
Next ii&
End If

I then use the 1D array (and three others) to initialize values in separate
chart SeriesCollections. I loop through the following code to create one
total percent chart and one total cost chart for a few dozen configurations.

With ActiveSheet.ChartObjects.Add _
(Left:=MonChPosL, Width:=MonChPosW, Top:=MonChPosT, Height:=MonChPosH)

.Chart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:="Line -
Column on 2 Axes"

With .Chart.SeriesCollection.NewSeries
.Values = Series1Array
.XValues = SeriesXValuesArray
.ChartType = xlColumnStacked
End With
With .Chart.SeriesCollection.NewSeries
.Values = Series2Array
.ChartType = xlColumnStacked
End With
With .Chart.SeriesCollection.NewSeries
.Values = Series3Array
.ChartType = xlColumnStacked
End With
With .Chart.SeriesCollection.NewSeries
.Values = Series4Array
.ChartType = xlLineMarkers
.AxisGroup = 2
End With

...
...
...

End With


My problem is the values of the fourth SeriesCollection is always a set of
zeros when Series4Array is taken from HistDB9 but not when its taken from
HistDB8. The strange thing is I get no runtime errors.

I've embedded a msgbox and confirmed that Series4Array is good.

With .Chart.SeriesCollection.NewSeries

If ChartToggle = False Then
For ii& = LBound(Series4Array) To UBound(Series4Array)
MsgBox "DG = " & ThisDG & "; Series4Array(" & ii& & ") = " &
Series4Array(ii&)
Next ii&
End If

.Values = Series4Array
.ChartType = xlLineMarkers
.AxisGroup = 2
End With

Any help will be greatly appreciated.

Thanks much.


Kevin

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigning array values to seriescollection Gerardo Excel Programming 0 March 11th 08 10:32 PM
SeriesCollection Values Property Oddity Greg Wilson Charts and Charting in Excel 4 December 3rd 05 04:26 AM
Cannot change SeriesCollection.Values! Why not? Parity Excel Programming 3 July 9th 05 01:12 AM
Line colour of .SeriesCollection.NewSeries? Dr.Ile[_3_] Excel Programming 1 June 17th 05 07:54 PM
Strange behavior Chart.SeriesCollection(n).Values property Emile van Mierlo Excel Programming 3 June 19th 04 06:07 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"