Thanks a lot. The code really worked me. Am able to change the size of pie chart. But when i tried to use the same code for increasing size of a bar graph. I got some error



Below is the code i was trying to run for bar graphs



#use strict; use warnings; use Win32::OLE; use Win32::OLE::Const 'Microsoft Excel'; my $xl = Win32::OLE->new('Excel.Application'); $xl->{Visible} = 0; my $wb = $xl->Workbooks->Add; $bar_data = [ [ "Sam",22], [ "Tom",22], [ "Teddy",22], [ "Tommy",22], [ "Simon",22], ]; $sheet = $wb -> Worksheets(1); $sheet -> Activate; $range_of_data = $wb->ActiveSheet->Range("A1:B5"); $chart = $wb->Charts->Add; $chart->SetSourceData($range_of_data, 2); $chart->{ChartType} = 96; $chart->Location(2, "Sheet2"); $chart->{AutoScaling} = 0; $chart->SeriesCollection(1)->Points(1)->Interior->{Color} = 255; #vbRe +d $chart->SeriesCollection(1)->Points(2)->Interior->{Color} = 255; #vbRe +d $chart->PlotArea->{Width} = 1000; $chart->PlotArea->{Height} = 1000; $wb->SaveAs("D:\\Output.xlsx"); $xl-> {DisplayAlerts} = 0; $xl->Quit; $wb = 0; $xl = 0;


Below is the error am getting


Can't call method "Points" on an undefined value


Please help me to increase the size of the bar graph


In reply to Re^4: Prepare charts using Win32::ole by soumyapanda
in thread Prepare charts using Win32::ole by soumyapanda

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.