Subject: | Creating a new axis doesn't set default tick label format |
When one just uses default axes, there is a default tick label format
assigned (seems to be %0.2f); this is fine. When one creates a new axis
from scratch, no such default format is assigned. Consequently, the
application barfs, unless one manually defines such a format. So, either
(prerefably) Chart::Clicker::Axis should do this by itself, or the docs
should specify that one has do do it manually. (The automatically
generated error message is not extremely helpful, because it comes from
deep down; so the average user will have trouble to find out how to
remedy the situation.)
Here's code that displays the problem:
-------------------------------------------
use Chart::Clicker;
use Chart::Clicker::Axis;
use Chart::Clicker::Data::DataSet;
use Chart::Clicker::Data::Series;
use Graphics::Primitive::Font;
use Graphics::Primitive::Brush;
my $lchart = Chart::Clicker->new();
my $vseries = Chart::Clicker::Data::Series->new({
keys => [ 0..23 ],
values => [ 50..73],
});
my $dataset = Chart::Clicker::Data::DataSet->new({
series => [ $vseries ],
});
$lchart->add_to_datasets($dataset);
my $yaxis = Chart::Clicker::Axis->new({
brush => Graphics::Primitive::Brush->new(),
font => Graphics::Primitive::Font->new(),
orientation => 'vertical',
position => 'left',
# format => '%0.1f', # uncomment to make it work
ticks => 8,
visible => 1,
range => Chart::Clicker::Data::Range->new({lower
=> 0, upper => 80}),
});
my $context = $lchart->get_context('default');
$context->range_axis($yaxis);
$lchart->write_output('dummy.png');