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

#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;
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


In reply to Re: Excel macro to perl conversion. by Grygonos
in thread Excel macro to perl conversion. by spikey_wan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.