New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gap property for each serie #113
Comments
Hi Tema, That is currently possible. See the Regards, John |
Example: use strict;
use warnings;
use Excel::Writer::XLSX;
my $filename = 'chart_gap01.xlsx';
my $workbook = Excel::Writer::XLSX->new( $filename );
my $worksheet = $workbook->add_worksheet();
my $chart = $workbook->add_chart( type => 'column', embedded => 1 );
my $data = [
[ 1, 2, 3, 4, 5 ],
[ 2, 4, 6, 8, 10 ],
[ 3, 6, 9, 12, 15 ],
];
$worksheet->write( 'A1', $data );
$chart->add_series(
categories => '=Sheet1!$A$1:$A$5',
values => '=Sheet1!$B$1:$B$5',
overlap => 5,
gap => 157,
);
$chart->add_series(
categories => '=Sheet1!$A$1:$A$5',
values => '=Sheet1!$C$1:$C$5',
);
$worksheet->insert_chart( 'E9', $chart );
$workbook->close();
|
Hi, Sorry, re-reading your question I see that you may already know about the As far as I know that isn't possible in Excel. You can change them for each series but Excel just changes it for all series. John |
Hi Tema, Thanks for the example. In that case this is a bug since the gap should be supported on each axis. I'll look into fixing it. Regards, John |
Thanks! I hope it would be easy for you. |
Hi Tema, I've pushed a fix for this to master. Here is an example: use strict;
use warnings;
use Excel::Writer::XLSX;
my $filename = 'chart_gap04.xlsx';
my $workbook = Excel::Writer::XLSX->new( $filename );
my $worksheet = $workbook->add_worksheet();
my $chart = $workbook->add_chart(type => 'column', embedded => 1);
my $data = [ [ 1, 2, 3, 4, 5 ],
[ 6, 8, 6, 4, 2 ] ];
$worksheet->write( 'A1', $data );
$chart->add_series(
values => '=Sheet1!$A$1:$A$5',
gap => 51,
overlap => 12,
);
$chart->add_series(
values => '=Sheet1!$B$1:$B$5',
gap => 251,
overlap => -27,
y2_axis => 1,
);
$worksheet->insert_chart( 'E9', $chart );
$workbook->close(); Try it if you get a chance. I'll push it to CPAN in the next day or two. John |
Yes, it works! |
Fixed in version 0.82. Thanks for the report and input. John. |
Hi! Excel format allows me to use specific 'gap' property for each bar/column on chart, but Excel::Writer::XLSX don't. Is it possible to use many 'gap' options?
The text was updated successfully, but these errors were encountered: