ralife has asked for the wisdom of the Perl Monks concerning the following question:
If anyone has any suggestions they would be greatly appreciated. Thanks in advance!use OLE; use Win32::OLE qw(in with); use Win32::OLE::Const "Microsoft Excel"; use Win32::OLE::Variant; use Win32::OLE::NLS qw(:LOCALE :DATE); $Excel = Win32::OLE->GetActiveObject('Excel.Application')||Win32::OLE- +>new('Excel.Application','Quit'); $Excel->{DisplayAlerts}=0; $Excel->{SheetsInNewWorkbook} = 16; $Book = $Excel->Workbooks->Add; $mcr_crtab_chart_sheet_name = "CreateTime_Chart"; $chart_sheet = $Book->Worksheets(16); $chart_sheet->{Name} = $mcr_crtab_chart_sheet_name; $mcr_crtime_chart = $Excel->Charts-Add; $mcr_crtime_chart->{ChartType} = xlLineMarkers; # or 65 $mcr_crtime_chart->SetSourceData({Source => $mcrsa_crtab_sheet->Rang +e("B1:F12"),PlotBy => xlColumns}); $range_1 = $mcrsa_crtab_sheet->Range("C2:C$row"); $range_2 = $mcrsa_crtab_sheet->Range("D2:D$row"); $mcr_crtime_chart->SeriesCollection(1)->LetProperty('XValues',$range +_1); $mcr_crtime_chart->SeriesCollection(1)->{Name} = "Series1"; $mcr_crtime_chart->SeriesCollection(2)->LetProperty('XValues',$range +_2); $mcr_crtime_chart->SeriesCollection(2)->{Name} = "Series2"; $mcr_crtime_chart->SeriesCollection(1)->ApplyDataLabels( { AutoText +=> 1,ShowValue => 1 } ); $mcr_crtime_chart->SeriesCollection(2)->ApplyDataLabels( { AutoText +=> 1,ShowValue => 1 } ); $mcr_crtime_chart->{HasLegend} = 1; $mcr_crtime_chart->Legend->{Position} = xlRight; $mcr_crtime_chart->{HasTitle} = 1; $mcr_crtime_chart->ChartTitle->{Text} = "CreateTime"; $mcr_crtime_chart->Axes(xlCategory,xlPrimary)->{HasTitle} = 1; $mcr_crtime_chart->Axes(xlCategory,xlPrimary)->AxisTitle->{Text} = " +Create Time (sec)"; $mcr_crtime_chart->Location({Where=> xlLocationAsObject, Name=> $mcr +_crtab_chart_sheet_name}); $Excel->{ActiveChart}->{Parent}->{top} = 10; $Excel->{ActiveChart}->{Parent}->{left} = 10;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need Help with Creating Excel Line Chart using Win32:OLE
by nbartusi (Scribe) on May 21, 2008 at 17:36 UTC | |
by ralife (Novice) on May 21, 2008 at 18:01 UTC |