當我使用公式來廣告它的名稱時(第一個系列:Max.
),但是當我直接編寫名稱時,我獲取默認名稱(第二個系列:Column B
而不是Min.
)。 爲什麼第二種方法在這裏不起作用? Excel::Writer::XLSX::Chart#CHART_METHODS是一個直接傳遞name屬性的例子。
我正在用LibreOffice打開文件。Excel :: Writer :: XLSX :: Chart - add_series():name-property-question
#!/usr/local/bin/perl
use warnings;
use 5.014;
use Excel::Writer::XLSX;
my $workbook = Excel::Writer::XLSX->new('spreadsheet.xlsx') or die $!;
my $worksheet = $workbook->add_worksheet('One');
my $ref = [
[ 'Max.', 'Min.' ],
[ 7, 5 ],
[ 11, 5 ],
[ 9, 2 ],
[ 8, 5 ], ];
$worksheet->write_col(0, 0, $ref);
my $chart = $workbook->add_chart(type => 'line');
$chart->add_series(
values => [ 'One', 1, $#$ref, 0, 0 ],
name => '=One!$A$1',
);
$chart->add_series(
values => [ 'One', 1, $#$ref, 1, 1 ],
name => 'Min.',
);