Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I'm using perl and Win32::OLE but I'm wondering if there are any known issues before I delve more into a perl solution. The problem is as follows: I have a data sheet with 5 columns of data called "$Sheet". In Excel 2000 each of the columns ends up in a separate series when creating a chart with the 5 columns in the datarange. When switching from Excel 2000 to Excel 2002 the chart creation takes the 5 column range and sets the first 4 columns as the first series. So I only get 2 series :-( Does anyone have any idea how to work around this or why it's happening? Any pointers to relevant documentation somwhere? Or any other suggestions? A small snip of the relevant code for context follows. (Anyone used to VB probably understand it) # My datarange my $Range = $Sheet-Range('B2:F38'); # Create a new chart my $num_of_Sheets = $Book-Worksheets-{Count}; my $chart = $Book-Charts-Add({After = $Book-Worksheets($num_of_Sheets)}) || die Win32::OLE-LastError(); # Name the chart $chart-{Name} = $Cdays[$dow-1]; $chart-SetSourceData({Source = $Range, PlotBy = xlColumns }); # Put Chart on a page of its own $chart-Location({Where = xlLocationAsNewSheet }); $chart-SeriesCollection(1)-{AxisGroup} = xlPrimary; $chart-SeriesCollection(1)-{ChartType} = xlColumnStacked; $chart-SeriesCollection(1)-Fill-TwoColorGradient(1,1); $chart-SeriesCollection(1)-Fill-ForeColor-{SchemeColor} = 10; $chart-SeriesCollection(1)-Fill-BackColor-{SchemeColor} = 1; $chart-SeriesCollection(2)-{AxisGroup} = xlPrimary; $chart-SeriesCollection(2)-{ChartType} = xlColumnStacked; $chart-SeriesCollection(2)-Fill-TwoColorGradient(1,1); $chart-SeriesCollection(2)-Fill-ForeColor-{SchemeColor} = 3; $chart-SeriesCollection(2)-Fill-BackColor-{SchemeColor} = 1; # Crashes on the following line with # Can't use an undefined value as a HASH reference at ..... file name and linenr $chart-SeriesCollection(3)-{AxisGroup} = xlSecondary; $chart-SeriesCollection(3)-{ChartType} = xlLineMarkers; $chart-SeriesCollection(3)-{MarkerBackgroundColorIndex} = 7; $chart-SeriesCollection(3)-{MarkerForegroundColorIndex} = 7; $chart-SeriesCollection(3)-{MarkerStyle} = xlTriangle; $chart-SeriesCollection(3)-Border-{Colorindex} = 7; $chart-SeriesCollection(3)-Border-{Weight} = xlMedium; SNIP REST.. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excel tries its best to figure out what we want when we don't tell it
enough. To ensure that Excel uses the columns you want for categories and the rows you want for series names, make sure the cell(s) at the intersection of these rows and columns are blank (completely clear, not just "" as a formula might return). So your example data would look like: Ans Missed AqT Man 08:00-08:15 148 56 43.275 80 08:15-08:30 153 18 11.9996 90 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jon Peltier writes:
Excel tries its best to figure out what we want when we don't tell it enough. To ensure that Excel uses the columns you want for categories and the rows you want for series names, make sure the cell(s) at the intersection of these rows and columns are blank (completely clear, not just "" as a formula might return). So your example data would look like: Ans Missed AqT Man 08:00-08:15 148 56 43.275 80 08:15-08:30 153 18 11.9996 90 . . . 16:45-17:00 12 1 2.7692 50 When the fourth column data was interpreted by Excel as text, it decided since it couldn't plot the text, that it would use it anyway. The only way it could figure to do this was to give you four columns of category labels, and only one series. Change the column of incorrectly identified text into decimal fractions (here's the language setting problem), and you get your other series back, with the one column of category labels. Yes when I got that part right everything else worked as expected. This might seem like a strange treatment, but it can be handy. I have used multi-column category labels, which are separated by carriage returns along the bottom axis, to give extra information about the plotted points. I'm going to use this. Thanks for the tip and help. /moller - Off to Scottland for a week. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Chart SeriesCollection Formula | Excel Discussion (Misc queries) | |||
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? | Excel Discussion (Misc queries) | |||
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? | New Users to Excel | |||
Excel 2000 to Excel 2002 problem | Excel Discussion (Misc queries) | |||
Setting SeriesCollection values in Excel 2000 | Excel Programming |