Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Win32::OLE + Excel charts issue 1

Status
Not open for further replies.

MoshiachNow

IS-IT--Management
Feb 6, 2002
1,851
IL
Hi,

With my following code the chart is created having 2 issues:
1.Sorted by rows and not columns
2.Instaed of Headers it shows as "serias",so headers are not taken in account.
Will appreciate advise.
thanks

========================
$Range->{Value} = \@alert1;
$Range->Font->{Bold} = 1;
#print STDOUT "A1:H1\n";
# Add data to spreadsheet
$Range = $Sheet->Range("A2:H10");
$Range->{Value} = \@Bars;

my $Chart = $Excel->Charts->Add;
$Chart->{ChartType} = '3';
#Line chart type
$Chart->SetSourceData({Source => $Range, PlotBy => 'xlColumns'});
$Chart->{'HasTitle'} = 1;
$Chart->ChartTitle->{Text} = "taskmon on $computer from $DATE8";


Long live king Moshiach !
 
I would suggest:

Open a new workbook
Record a new macro
Create a graph manually
Go to Excel VBA Editor
Copy VBA Code
Convert it to Object Oriented Language.

That´s what I do and it works fine using Win32::Ole Module.

Cheers






dmazzini
GSM/UMTS System and Telecomm Consultant

 
Still the same with updated code - does not bringthe right chart type and sorting by columns ...

$Range = $Sheet->Range("A1:$range4");
my $Chart = $Excel->Charts->Add;
$Chart->{ChartType} = 'xlLineMarkers'; #Line chart type
$Chart->SetSourceData({Source => $Range, PlotBy => 'xlColumns'});
$Chart->{'HasTitle'} = 1;
$Chart->ChartTitle->{Text} = "taskmon on $computer from $DATE8";

# Save workbook to file
unlink "$TEMP\\chart.xls" if -f "$TEMP\\chart.xls";
$Book->SaveAs("$TEMP\\chart.xls");
$Book->Close;

Long live king Moshiach !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top