【问题标题】:Excel::Writer::XLSX::Chart::Line - QuestionExcel::Writer::XLSX::Chart::Line - 问题
【发布时间】:2011-09-16 22:48:57
【问题描述】:

有没有办法为图表中的 to 线(最高温度和最低温度)之间的空间着色?

#!/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',
);

【问题讨论】:

    标签: perl excel colors charts spreadsheet


    【解决方案1】:

    我认为这个功能在 Excel 中不可用,因此在 Excel::Writer::XLSX 中是不可能的。

    至少它不能作为 Excel 中的单个操作使用。有一些解决方法,例如 here 和 here,但您目前在 Excel::Writer::XLSX 中没有这种级别的控制。

    Droplines/High-Low 线将在未来的版本中添加。这可能是一个可以接受的解决方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-13
      • 2020-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-29
      相关资源
      最近更新 更多