Spreatsheet:WriteExcel create Chart

Posted by yaohung on Stack Overflow See other posts from Stack Overflow or by yaohung
Published on 2010-04-23T04:15:14Z Indexed on 2010/04/23 4:23 UTC
Read the original article Hit count: 205

Filed under:

Hi,

I used

csv2xls.pl to convert a text log into .xls file, and then apply create chart function as following:

my $chart3 = $workbook->add_chart( type => 'line' , embedded => 1);

Configure the series.

$chart3->add_series( categories => '=Sheet1!$B$2:$B$64', values => '=Sheet1!$C$2:$C$64', name => 'Test data series 1', );

Add some labels.

$chart3->set_title( name => 'Bridge Rate Analysis' ); $chart3->set_x_axis( name => 'Packet Size ' ); $chart3->set_y_axis( name => 'BVI Rate' );

Insert the chart into the main worksheet.

$worksheet->insert_chart( 'G2', $chart3 );

========== I can see the chart in .xls file, however, all the data is in text format, not number, therefore, the chart looks wrong. I am wondering can you tell me how to convert text into number before apply this create chart function? One other thing is any idea how to apply sorting on the .xls file before create chart?

Thanks.

Yaohung

© Stack Overflow or respective owner

Related posts about perl