| 1 | package Chart::OFC2::HBar; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Chart::OFC2::HBar - OFC2 horizontal bar chart | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | my $chart = Chart::OFC2->new( | ||
| 10 | 'title' => 'HBar chart test', | ||
| 11 | 'y_axis' => Chart::OFC2::YAxis->new( | ||
| 12 | 'labels' => [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun' ], | ||
| 13 | 'offset' => 1, | ||
| 14 | ), | ||
| 15 | 'tooltip' => { | ||
| 16 | 'mouse' => 2, | ||
| 17 | }, | ||
| 18 | ); | ||
| 19 | |||
| 20 | my $hbar = Chart::OFC2::HBar->new( | ||
| 21 | 'values' => [ { 'left' => 1.5, 'right' => 3, }, 1, 2, 3, 4, 5, ], | ||
| 22 | 'colour' => '#40FF0D', | ||
| 23 | ); | ||
| 24 | |||
| 25 | print $chart->render_chart_data(); | ||
| 26 | |||
| 27 | =head1 DESCRIPTION | ||
| 28 | |||
| 29 | extends 'Chart::OFC2::BarLineBase'; | ||
| 30 | |||
| 31 | In L<Chart::OFC2::HBarValues> when converting values to JSON the values are | ||
| 32 | reversed. This is done so that the C<y_axis->labels> match to the values. | ||
| 33 | Also note that the C<y_axis->offset> is set to one so that the label is | ||
| 34 | in the middle of the bar. | ||
| 35 | |||
| 36 | =cut | ||
| 37 | |||
| 38 | 0 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 39 | use MooseX::StrictConstructor; | ||
| 40 | |||
| 41 | our $VERSION = '0.07'; | ||
| 42 | |||
| 43 | extends 'Chart::OFC2::BarLineBase'; | ||
| 44 | |||
| 45 | use Chart::OFC2::HBarValues; | ||
| 46 | |||
| 47 | =head1 PROPERTIES | ||
| 48 | |||
| 49 | has '+type_name' => (default => 'hbar'); | ||
| 50 | |||
| 51 | =cut | ||
| 52 | |||
| 53 | has '+type_name' => (default => 'hbar'); | ||
| 54 | has 'values' => (is => 'rw', isa => 'Chart::OFC2::HBarValues', 'coerce' => 1,); | ||
| 55 | |||
| 56 | 1; | ||