Skip to content
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

Chart Axis Title Rotation not working. #83

Closed
msmcgillis opened this issue Nov 30, 2013 · 4 comments
Closed

Chart Axis Title Rotation not working. #83

msmcgillis opened this issue Nov 30, 2013 · 4 comments
Assignees
Labels

Comments

@msmcgillis
Copy link

Expected the following code to produce a x axis title rotated 45 degrees. However it does not have any rotation when viewed from excel.

use Excel::Writer::XLSX;

my $workbook  = Excel::Writer::XLSX->new( "text.xlsx" );
my $worksheet = $workbook->add_worksheet();
my $chart     = $workbook->add_chart( type => 'line', embedded => 1 );

# For testing, copy the randomly generated axis ids in the target xlsx file.
$chart->{_axis_ids} = [ 47076480, 47078016 ];

my $data = [
    [ 1, 2, 3, 4,  5 ],
    [ 2, 4, 6, 8,  10 ],
    [ 3, 6, 9, 12, 15 ],

];

$worksheet->write( 'A1', $data );

$chart->add_series( values => '=Sheet1!$A$1:$A$5' );
$chart->add_series( values => '=Sheet1!$B$1:$B$5' );
$chart->add_series( values => '=Sheet1!$C$1:$C$5' );

$chart->set_x_axis( name          => "XXX",
                    name_font     => { color => "blue", rotation => 45 } );

$worksheet->insert_chart( 'E9', $chart );

$workbook->close();
msmcgillis added a commit to msmcgillis/excel-writer-xlsx that referenced this issue Nov 30, 2013
Conflicts:
	lib/Excel/Writer/XLSX/Chart.pm

This version includes additional functionality that is tested through
the t/regression/experimenta*.t files as follows:

01 -> y2 support (Now part of 0.51+)
02 -> title font support name_font (Now part of 0.53+)
03 -> legend font support (Now part of 0.73+)
04 -> legend layout support (now part of (0.74+)
05 -> axis tick label skip support
06 -> axis tick mark skip support
07 -> axis number format support num_format (Now part of 0.54+)
08 -> axis label rotation (Now part of 0.69+)
09 -> axis label font num_font (Now part of 0.53+)
10 -> axis title font name_font (Now part of 0.53+)
11 -> axis title rotation (Now part of 0.69+)

Item 4 requires mapping w -> width and h -> height
Item 8 requires mapping num_rotataion -> num_font{rotation}
Item 11 requires mapping name_rotation -> name_font{rotation}

Currently Item 11 appears to be broken in 0.74 generated issue jmcnamara#83.
@ghost ghost assigned jmcnamara Nov 30, 2013
@jmcnamara
Copy link
Owner

Thanks for the detailed report. That looks like a bug. I'll look into it.

jmcnamara added a commit that referenced this issue Nov 30, 2013
@jmcnamara
Copy link
Owner

Can you try the latest version on the master branch. I've added a test case and it looks okay.

There may be a similar issue with the chart title. I'm looking into that.

@msmcgillis
Copy link
Author

Looks good working for me now.

@jmcnamara
Copy link
Owner

Fixed in version 0.75 which has been uploaded to CPAN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants