in reply to Excel macro to perl conversion.
your variable $chart is not being populated. do print $chart; after you try to set it.. it should print out an ole hash ref... if it doesn't then you know you didn't get the reference assigned correctly. Are you sure "Chart 1" is the name.. or that it even exists at this point since it seems you are trying to edit a chart?
Well, since I don't know exactly what this code is trying to do on a larger level (i.e. edit an old series or make a new one) I can only provide this example of working code from one of my scripts that uses graphs
This code creates two charts via the add method of chartobjects. It then sets the type of the chart object, and then adds a set of series to each of them, and sets their background colors. I hope this helps. If you edit and post the whole intent of the code I may be able to help more#Create embedded chart objects my $production_chart = $sheet->ChartObjects->Add(25,250,300,160); my $performance_chart = $sheet->ChartObjects->Add(350,250,300,160) +; #Set the Chart Type $performance_chart->Chart->{ChartType} = $$xlConst{'xlLine'}; $production_chart->Chart->{ChartType} = $$xlConst{'xlLine'}; #Create the series $production_chart->Chart->SeriesCollection->Add($sheet->Range($_." +4:".$_."16"), $$xlConst{'xlColum +ns'}, TRUE) for(qw(E F G + H)); #Create the series $performance_chart->Chart->SeriesCollection->Add($sheet->Range($_. +"4:".$_."16"), $$xlConst{'xlColu +mns'}, TRUE) for(qw(I J) +); #Color the background of the charts $performance_chart->Chart->PlotArea->Interior->{ColorIndex} = 0; $production_chart->Chart->PlotArea->Interior->{ColorIndex} = 0;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Excel macro to perl conversion.
by spikey_wan (Scribe) on Oct 15, 2004 at 09:52 UTC | |
by Grygonos (Chaplain) on Oct 15, 2004 at 13:12 UTC | |
by spikey_wan (Scribe) on Oct 15, 2004 at 15:45 UTC |