Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to graph a 2-dimensional array?


I need to graph this 2-dimensional array PlotSeries(18,13). The first
dimension is months, and the 2nd dimension has names. I want to do a
line graph using the 1st dimension on the X axis. Each element in the
2nd dimension is a line in the graph. The array looks like this:
200301 200301 200303 200304
Marg 23.45 87.1 17.32 12.42
Ben 98.1 13.2 82.11 38.4
Kay 19.1 98 12 87.12

I tried the following code, but it did not work.

Dim PlotRow() As Double
ReDim PlotRow(NumUniqMnths) As Double
For i = 1 To 13
For j = 1 To 18
PlotRow(j) = PlotSeries(i, j)
Next j
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).Values = PlotRow
Next i


Does anybody has some sample code? Thanks!!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default How to graph a 2-dimensional array?

The easy way? Dump the array into a range, and use the range as the
chart's source data.

with ActiveSheet
.cells(1,1).resize(18,13).Value = PlotSeries
.chartobjects.add 100,100,325,225
.chartobjects(.chartobjects.count).chart.setsource data _
source:=.cells(1,1).resize(18,13)
end with

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______

clui wrote:

I need to graph this 2-dimensional array PlotSeries(18,13). The first
dimension is months, and the 2nd dimension has names. I want to do a
line graph using the 1st dimension on the X axis. Each element in the
2nd dimension is a line in the graph. The array looks like this:
200301 200301 200303 200304
Marg 23.45 87.1 17.32 12.42
Ben 98.1 13.2 82.11 38.4
Kay 19.1 98 12 87.12

I tried the following code, but it did not work.

Dim PlotRow() As Double
ReDim PlotRow(NumUniqMnths) As Double
For i = 1 To 13
For j = 1 To 18
PlotRow(j) = PlotSeries(i, j)
Next j
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).Values = PlotRow
Next i


Does anybody has some sample code? Thanks!!


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
How to: 3 dimensional graph Four Kings Excel Discussion (Misc queries) 0 January 28th 06 05:46 PM
Three Dimensional Array Question Tornados Excel Discussion (Misc queries) 1 June 20th 05 12:58 AM
add to two dimensional array GUS Excel Programming 1 August 26th 03 12:12 AM
2 Dimensional Array Tom Ogilvy Excel Programming 0 August 18th 03 08:04 PM
2 Dimensional Array steve Excel Programming 0 August 18th 03 07:19 PM


All times are GMT +1. The time now is 12:39 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"