• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

inc/Module/H24-Mar-2011-2,0871,555

lib/Chart/Math/H24-Mar-2011-476185

t/H24-Mar-2011-307200

xt/H24-Mar-2011-9461

ChangesH A D24-Mar-20111.1 KiB4331

LICENSEH A D24-Mar-201119.7 KiB379304

MANIFESTH A D24-Mar-2011418 2322

META.ymlH A D24-Mar-2011818 3433

Makefile.PLH A D24-Mar-2011145 64

READMEH A D24-Mar-20114.1 KiB12289

README

1NAME
2    Chart::Math::Axis - Implements an algorithm to find good values for
3    chart axis
4
5SYNOPSIS
6      # Create a new Axis
7      my $axis = Chart::Math::Axis->new;
8
9  # Provide is some data to calculate on
10      $axis->add_data( @dataset );
11
12  # Get the values for the axis
13      print "Top of axis: "     . $axis->top           . "\n";
14      print "Bottom of axis: "  . $axis->bottom        . "\n";
15      print "Tick interval: "   . $axis->interval_size . "\n";
16      print "Number of ticks: " . $axis->ticks         . "\n";
17
18  # Apply the axis directly to a GD::Graph.
19      $axis->apply_to( $graph );
20
21DESCRIPTION
22    Chart::Math::Axis implements in a generic way an algorithm for finding a
23    set of ideal values for an axis. That is, for any given set of data,
24    what should the top and bottom of the axis scale be, and what should the
25    interval between the ticks be.
26
27    The terms "top" and "bottom" are used throughout this module, as it's
28    primary use is for determining the Y axis. For calculating the X axis,
29    you should think of 'top' as 'right', and 'bottom' as 'left'.
30
31METHODS
32  new
33      my $null = Chart::Math::Axis->new;
34      my $full = Chart::Math::Axis->new( @dataset );
35
36    The "new" method creates a new "Chart::Math::Axis" object. Any arguments
37    passed to the constructor are used as dataset values. Whenever the
38    object has some values on which to work, it will calculate the axis. If
39    the object is created with no values, most methods will return undef.
40
41  max
42    Returns the maximum value in the dataset.
43
44  min
45    Returns the minimum value in the dataset.
46
47  top
48    The "top" method returns the value that should be the top of the axis.
49
50  bottom
51    The "bottom" method returns the value that should be the bottom of the
52    axis.
53
54  maximum_intervals
55    Although Chart::Math::Axis can work out scale and intervals, it doesn't
56    know how many pixels you might need, how big labels etc are, so it can
57    determine the tick density you are going to need. The
58    "maximum_intervals" method returns the current value for the maximum
59    number of ticks the object is allowed to have.
60
61    To change this value, see the "set_maximum_intervals" method. The
62    default for the maximum number of intervals is 10.
63
64  interval_size
65    The "interval_size" method returns the interval size in dataset terms.
66
67  ticks
68    The "ticks" method returns the number of intervals that the
69    top/bottom/size values will result in.
70
71  add_data
72      $self->add_data( @dataset );
73
74    The "add_data" method allows you to provide data that the object should
75    be aware of when calculating the axis. In fact, you can add additional
76    data at any time, and the axis will be updated as needed.
77
78  set_maximum_intervals
79      $self->set_maximum_intervals( $intervals );
80
81    The "set_maximum_intervals" method takes an argument and uses it as the
82    maximum number of ticks the axis is allowed to have.
83
84  include_zero
85    If you have a dataset something like ( 10, 11, 12 ) the bottom of the
86    axis will probably be somewhere around 9 or 8. That is, it won't show
87    the zero axis. If you want to force the axis to include zero, use this
88    method to do so.
89
90  apply_to
91      $self->apply_to( $gd_graph_object )
92
93    The "apply_to" method is intended to provide a series of shortcuts for
94    automatically applying an axis to a graph of a know type. At the
95    present, this will change only the Y axis of a GD::Graph object. This
96    method is considered experimental. If in doubt, extract and set the
97    graph values yourself.
98
99SUPPORT
100    Bugs should be reported via the CPAN bug tracker
101
102    <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Chart-Math-Axis>
103
104    For other issues, or commercial enhancement or support, contact the
105    author.
106
107AUTHOR
108    Adam Kennedy <adamk@cpan.org>
109
110SEE ALSO
111    GD::Graph, <http://ali.as/>
112
113COPYRIGHT
114    Copyright 2002 - 2011 Adam Kennedy.
115
116    This program is free software; you can redistribute it and/or modify it
117    under the same terms as Perl itself.
118
119    The full text of the license can be found in the LICENSE file included
120    with this module.
121
122