use error mechanism instead of die if Chart::Math::Axis isn't available.
}
# Scale the graph box down to the widest graph that can cleanly hold the # of columns.
}
# Scale the graph box down to the widest graph that can cleanly hold the # of columns.
- $self->_get_data_range();
+ return unless $self->_get_data_range();
$self->_remove_tics_from_chart_box(\@chart_box);
my $column_count = $self->_get_column_count();
$self->_remove_tics_from_chart_box(\@chart_box);
my $column_count = $self->_get_column_count();
if ($self->_get_number('automatic_axis')) {
# In case this was set via a style, and not by the api method
if ($self->_get_number('automatic_axis')) {
# In case this was set via a style, and not by the api method
- eval { require "Chart/Math/Axis.pm"; };
+ eval { require Chart::Math::Axis; };
- die "Can't use automatic_axis - $@";
+ return $self->_error("Can't use automatic_axis - $@");
}
my $axis = Chart::Math::Axis->new();
}
my $axis = Chart::Math::Axis->new();
$self->_set_max_value($max_value);
$self->_set_min_value($min_value);
$self->_set_column_count($column_count);
$self->_set_max_value($max_value);
$self->_set_min_value($min_value);
$self->_set_column_count($column_count);
=item use_automatic_axis()
=item use_automatic_axis()
-Automatically scale the Y axis, based on L<Chart::Math::Axis>
+Automatically scale the Y axis, based on L<Chart::Math::Axis>. If Chart::Math::Axis isn't installed, this sets an error and returns undef. Returns 1 if it is installed.
=cut
sub use_automatic_axis {
=cut
sub use_automatic_axis {
- eval { require "Chart/Math/Axis.pm"; };
+ eval { require Chart::Math::Axis; };
- die "use_automatic_axis - $@\nCalled from ".join(' ', caller)."\n";
+ return $_[0]->_error("use_automatic_axis - $@\nCalled from ".join(' ', caller)."\n");
}
$_[0]->{'custom_style'}->{'automatic_axis'} = 1;
}
$_[0]->{'custom_style'}->{'automatic_axis'} = 1;