NAME
Chart::Clicker::Axis
DESCRIPTION
Chart::Clicker::Axis represents the plot of the chart.
SYNOPSIS
use Chart::Clicker::Axis;
use Graphics::Primitive::Font;
use Graphics::Primitive::Brush;
my $axis = Chart::Clicker::Axis->new({
font => Graphics::Primitive::Font->new,
orientation => 'vertical',
position => 'left',
show_ticks => 1,
brush = Graphics::Primitive::Brush->new,
tick_length => 2,
tick_brush => Graphics::Primitive::Brush->new,
visible => 1,
});
METHODS
Constructor
- new
-
Creates a new Chart::Clicker::Axis. If no arguments are given then sane defaults are chosen.
Instance Methods
- baseline
-
Set the 'baseline' value of this axis. This is used by some renderers to change the way a value is marked. The Bar render, for instance, considers values below the base to be 'negative'.
- brush
-
Set/Get the brush for this axis.
- color
-
Set/Get the color of the axis.
- font
-
Set/Get the font used for the axis' labels.
- format
-
Set/Get the format to use for the axis values.
If the format is a string then format is applied to each value 'tick' via sprintf. See sprintf perldoc for details! This is useful for situations where the values end up with repeating decimals.
If the format is a coderef then that coderef will be executed and the value passed to it as an argument.
my $nf = Number::Format->new; $default->domain_axis->format(sub { return $nf->format_number(shift); });
- fudge_amount
-
Set/Get the amount to 'fudge' the span of this axis. You should supply a percentage (in decimal form) and the axis will grow at both ends by the supplied amount. This is useful when you want a bit of padding above and below the dataset.
As an example, a fugdge_amount of .10 on an axis with a span of 10 to 50 would add 5 to the top and bottom of the axis.
- height
-
Set/Get the height of the axis.
- label
-
Set/Get the label of the axis.
- orientation
-
Set/Get the orientation of this axis. See Chart::Clicker::Drawing.
- position
-
Set/Get the position of the axis on the chart.
- range
-
Set/Get the Range for this axis.
- show_ticks
-
Set/Get the show ticks flag. If this is value then the small tick marks at each mark on the axis will not be drawn.
- tick_length
-
Set/Get the tick length.
- tick_values
-
Set/Get the arrayref of values show as ticks on this Axis.
- add_to_tick_values
-
Add a value to the list of tick values.
- clear_tick_values
-
Clear all tick values.
- tick_brush
-
Set/Get the stroke for the tick markers.
- tick_value_count
-
Get a count of tick values.
- tick_labels
-
Set/Get the arrayref of labels to show for ticks on this Axis. This arrayref is consulted for every tick, in order. So placing a string at the zeroeth index will result in it being displayed on the zeroeth tick, etc, etc.
- ticks
-
Set/Get the number of 'ticks' to show. Setting this will divide the range on this axis by the specified value to establish tick values. This will have no effect if you specify tick_values.
- mark
-
Given a span and a value, returns it's pixel position on this Axis.
- format_value
-
Given a value, returns it formatted using this Axis' formatter.
- prepare
-
Prepare this Axis by determining the size required. If the orientation is CC_HORIZONTAL this method sets the height. Otherwise sets the width.
- draw
-
Draw this axis.
-
Set/Get this axis' hidden flag.
- width
-
Set/Get this axis' width.
AUTHOR
Cory 'G' Watson <gphat@cpan.org>
SEE ALSO
perl(1)
LICENSE
You can redistribute and/or modify this code under the same terms as Perl itself.