| 1 | package Chart::OFC::YAxis; | ||||||||||
| 2 | 21 | $Chart::OFC::YAxis::VERSION = '0.12'; | |||||||||
| 3 | 21 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 21 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 21 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 21 | ▶ | use MooseX::StrictConstructor; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 21 | ▶ | use Chart::OFC::Types; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 21 | extends 'Chart::OFC::Axis'; | |||||||||
| 11 | |||||||||||
| 12 | |||||||||||
| 13 | 21 | has min => | |||||||||
| 14 | ( is => 'ro', | ||||||||||
| 15 | isa => 'Num', | ||||||||||
| 16 | default => 0, | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | 21 | has max => | |||||||||
| 20 | ( is => 'ro', | ||||||||||
| 21 | isa => 'Num', | ||||||||||
| 22 | required => 1, | ||||||||||
| 23 | ); | ||||||||||
| 24 | |||||||||||
| 25 | 21 | has small_tick_size => | |||||||||
| 26 | ( is => 'ro', | ||||||||||
| 27 | isa => 'Int', | ||||||||||
| 28 | default => 5, | ||||||||||
| 29 | ); | ||||||||||
| 30 | |||||||||||
| 31 | 21 | has large_tick_size => | |||||||||
| 32 | ( is => 'ro', | ||||||||||
| 33 | isa => 'Int', | ||||||||||
| 34 | default => 10, | ||||||||||
| 35 | ); | ||||||||||
| 36 | |||||||||||
| 37 | 21 | has label_steps => | |||||||||
| 38 | ( is => 'ro', | ||||||||||
| 39 | isa => 'Chart::OFC::Type::PosInt', | ||||||||||
| 40 | required => 1, | ||||||||||
| 41 | ); | ||||||||||
| 42 | |||||||||||
| 43 | sub _ofc_data_lines | ||||||||||
| 44 | 10 | ▶ | { | ||||||||
|
Subroutine
_ofc_data_lines: called CC=3 SCAR=11.0
| |||||||||||
| 45 | 10 | my $self = shift; | |||||||||
| 46 | |||||||||||
| 47 | 10 | my @lines = $self->axis_label()->_ofc_data_lines('y'); | |||||||||
| 48 | |||||||||||
| 49 | 10 | push @lines, $self->_data_line( 'y_label_style', | |||||||||
| 50 | $self->text_size(), | ||||||||||
| 51 | $self->text_color(), | ||||||||||
| 52 | ); | ||||||||||
| 53 | |||||||||||
| 54 | 10 | push @lines, $self->_data_line( 'y_ticks', | |||||||||
| 55 | $self->small_tick_size(), | ||||||||||
| 56 | $self->large_tick_size(), | ||||||||||
| 57 | int( ( $self->max() - $self->min() ) / $self->label_steps() ), | ||||||||||
| 58 | ); | ||||||||||
| 59 | |||||||||||
| 60 | 10 | push @lines, $self->_data_line( 'y_min', $self->min() ); | |||||||||
| 61 | |||||||||||
| 62 | 10 | push @lines, $self->_data_line( 'y_max', $self->max() ); | |||||||||
| 63 | |||||||||||
| 64 | 10 | ▶ | push @lines, $self->_data_line( 'y_axis_colour', $self->axis_color() ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | if $self->_has_axis_color(); | ||||||||||
| 66 | |||||||||||
| 67 | 10 | ▶ | push @lines, $self->_data_line( 'y_grid_colour', $self->grid_color() ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 68 | if $self->_has_grid_color(); | ||||||||||
| 69 | |||||||||||
| 70 | 10 | return @lines; | |||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | 21 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 74 | |||||||||||
| 75 | 21 | __PACKAGE__->meta()->make_immutable(); | |||||||||
| 76 | |||||||||||
| 77 | 21 | 1; | |||||||||
| 78 | |||||||||||
| 79 | |||||||||||
| 80 | # ABSTRACT: Y axis for grid charts | ||||||||||
| 81 | |||||||||||
| 82 | __END__ | ||||||||||