Excel-Writer-XLSX
view release on metacpan or search on metacpan
lib/Excel/Writer/XLSX/Chartsheet.pm view on Meta::CPAN
###############################################################################
#
# Public methods.
#
###############################################################################
# Over-ride parent protect() method to protect both worksheet and chart.
sub protect {
my $self = shift;
my $password = shift || '';
my $user_options = shift;
my $options = {};
# Objects are default on for chartsheets.
if ( defined $user_options->{objects} ) {
$options->{objects} = not $user_options->{objects};
}
else {
$options->{objects} = 0;
}
if ( defined $user_options->{content} ) {
$options->{content} = $user_options->{content};
}
else {
$options->{content} = 1;
}
# If objects and content are off then the chartsheet isn't locked, except
# if it has a password.
if ( $password eq '' && $options->{objects} && !$options->{content} ) {
return;
}
$self->{_chart}->{_protection} = 1;
# Turn off worksheet defaults.
$options->{sheet} = 0;
$options->{scenarios} = 1;
$self->SUPER::protect( $password, $options );
}
###############################################################################
#
# Encapsulated Chart methods.
#
###############################################################################
sub add_series { return shift->{_chart}->add_series( @_ ) }
sub combine { return shift->{_chart}->combine( @_ ) }
sub set_x_axis { return shift->{_chart}->set_x_axis( @_ ) }
sub set_y_axis { return shift->{_chart}->set_y_axis( @_ ) }
sub set_x2_axis { return shift->{_chart}->set_x2_axis( @_ ) }
sub set_y2_axis { return shift->{_chart}->set_y2_axis( @_ ) }
sub set_title { return shift->{_chart}->set_title( @_ ) }
sub set_legend { return shift->{_chart}->set_legend( @_ ) }
sub set_plotarea { return shift->{_chart}->set_plotarea( @_ ) }
sub set_chartarea { return shift->{_chart}->set_chartarea( @_ ) }
sub set_style { return shift->{_chart}->set_style( @_ ) }
sub show_blanks_as { return shift->{_chart}->show_blanks_as( @_ ) }
sub show_na_as_empty_cell { return shift->{_chart}->show_na_as_empty_cell( @_ ) }
sub show_hidden_data { return shift->{_chart}->show_hidden_data( @_ ) }
sub set_size { return shift->{_chart}->set_size( @_ ) }
sub set_table { return shift->{_chart}->set_table( @_ ) }
sub set_up_down_bars { return shift->{_chart}->set_up_down_bars( @_ ) }
sub set_drop_lines { return shift->{_chart}->set_drop_lines( @_ ) }
sub set_high_low_lines { return shift->{_chart}->high_low_lines( @_ ) }
###############################################################################
#
# Internal methods.
#
###############################################################################
###############################################################################
#
# _prepare_chart()
#
# Set up chart/drawings.
#
sub _prepare_chart {
my $self = shift;
my $index = shift;
my $chart_id = shift;
my $drawing_id = shift;
$self->{_chart}->{_id} = $chart_id -1;
my $drawing = Excel::Writer::XLSX::Drawing->new();
$self->{_drawing} = $drawing;
$self->{_drawing}->{_orientation} = $self->{_orientation};
push @{ $self->{_external_drawing_links} },
[ '/drawing', '../drawings/drawing' . $drawing_id . '.xml' ];
push @{ $self->{_drawing_links} },
[ '/chart', '../charts/chart' . $chart_id . '.xml' ];
}
###############################################################################
#
# XML writing methods.
#
###############################################################################
###############################################################################
#
# _write_chartsheet()
#
# Write the <chartsheet> element. This is the root element of Chartsheet.
( run in 0.768 second using v1.01-cache-2.11-cpan-39bf76dae61 )