开发者

Excel::Writer::XLSX::Chart::Line - Question

Is there a way to colorize the space between the to lines (Max. Temp and Min. Temp.) in the chart?

#!/usr/local/bin/perl
use warnings;
use 5.014;
use utf8;
use Excel::Writer::XLSX;
my $workbook = Excel::Writer::XLSX->new( 'spreadsheet.xlsx' ) or die $!;
my $worksheet = $workbook->add_worksheet( 'One' );
my $ref = [
[ 'Day', 'Max. Temp.', 'Min. Temp' ],
[ 1, -3.1开发者_开发问答, -6.4 ],
[ 2, -2.3, -7.2 ],
[ 3, -4.7, -6.8 ],
[ 4, -3.1, -9.5 ],
[ 5, 1.1, -11.4 ],
[ 6, 1.2, 0.3 ],
[ 7, 5.3, 0.7 ],
[ 8, 7.7, 1.5 ],
[ 9, 1.5, -2 ],
[ 10, 1, -1.1 ] ];
$worksheet->write_col( 0, 0, $ref );

my $chart = $workbook->add_chart( type => 'line' );
$chart->set_x_axis( name => 'Day' );
$chart->set_y_axis( name => 'Temperature (° Celsius)' );
$chart->set_style( 11 );

$chart->add_series(
    values => [ 'One', 1, $#$ref, 1, 1 ],
    name => '=One!$B$1',
);

$chart->add_series(
    values => [ 'One', 1, $#$ref, 2, 2 ],
    name => '=One!$C$1',
);


I don't think that this feature is available in Excel so it isn't possible in Excel::Writer::XLSX.

At least it isn't available as a single operation in Excel. There are some workarounds, for example here and here, but you don't currently have that level of control in Excel::Writer::XLSX.

Droplines/High-Low lines will be added in a future release. That might be an acceptable workaround.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜