App-Chart
view release on metacpan or search on metacpan
lib/App/Chart/Gtk2/HAxis.pm view on Meta::CPAN
sub _do_configure_event {
my ($self, $event) = @_;
$self->queue_draw;
return shift->signal_chain_from_overridden(@_);
}
# Return the width in pixels needed to draw the given $format_func string in
# $layout.
#
# This is only geared towards the month/year formats above. It goes through
# all the months Jan to Dec to see how they come out, but assumes year 2000
# is as wide as any year will be.
#
sub format_func_width {
my ($layout, $format_func) = @_;
return max (map { my $str = $format_func->(2000, $_);
$layout->set_text ($str);
my ($str_width, $str_height) = $layout->get_pixel_size;
$str_width;
} 1 .. 12);
}
1;
__END__
=for stopwords undef HAxis
=head1 NAME
App::Chart::Gtk2::HAxis -- horizontal timebase axis display widget
=head1 SYNOPSIS
my $hscale = App::Chart::Gtk2::HAxis->new();
=head1 WIDGET HIERARCHY
C<App::Chart::Gtk2::HAxis> is a subclass of C<Gtk2::DrawingArea>.
Gtk2::Widget
Gtk2::DrawingArea
App::Chart::Gtk2::HAxis
=head1 DESCRIPTION
A C<App::Chart::Gtk2::HAxis> widget displays tick marks and dates on a
horizontal axis, for use below a C<App::Chart::Gtk2::Graph>.
=head1 PROPERTIES
=over 4
=item C<adjustment> (C<Gtk2::Adjustment>, default undef)
An adjustment object giving the range of dates to display. The HAxis
display updates as the adjustment moves.
=item C<timebase> (C<App::Chart::Timebase> object, default undef)
The timebase for the dates displayed. This is used to get the actual
calendar date represented by integer values from the C<adjustment>.
=back
=head1 SEE ALSO
L<App::Chart::Gtk2::Graph>
=head1 HOME PAGE
L<http://user42.tuxfamily.org/chart/index.html>
=head1 LICENCE
Copyright 2007, 2008, 2009, 2010, 2011, 2014 Kevin Ryde
Chart is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version.
Chart is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
Chart; see the file F<COPYING>. Failing that, see
L<http://www.gnu.org/licenses/>.
=cut
( run in 0.637 second using v1.01-cache-2.11-cpan-39bf76dae61 )