Chart-GGPlot
view release on metacpan or search on metacpan
lib/Chart/GGPlot/Built.pm view on Meta::CPAN
package Chart::GGPlot::Built;
# ABSTRACT: A processed ggplot that can be rendered
use Chart::GGPlot::Class qw(:pdl);
use namespace::autoclean;
our $VERSION = '0.002003'; # VERSION
use Data::Frame::Types qw(DataFrame);
use List::AllUtils qw(pairmap);
use Types::Standard qw(ArrayRef ConsumerOf);
use Chart::GGPlot::Types qw(:all);
has data => ( is => 'ro', isa => ArrayRef [DataFrame] );
has prestats_data => ( is => 'ro', isa => ArrayRef [DataFrame] );
has layout => ( is => 'ro', isa => ConsumerOf['Chart::GGPlot::Layout'] );
has plot => ( is => 'ro', isa => ConsumerOf['Chart::GGPlot::Plot'] );
method layer_data ( $i = 0 ) {
return $self->data->at($i);
}
method layer_prestats_data ( $i = 0 ) {
return $self->prestats_data->at($i);
}
method layer_scales ( $i = 0, $j = 0 ) {
my $layout = $self->layout->layout;
my $which =
( which( $layout->at('ROW') == $i ) & which( $layout->at('COL') == $j ) );
my $selected = $layout->select_rows($which);
return {
x => $self->layout->panel_scales_x->at( $selected->at('SCALE_X') ),
y => $self->layout->panel_scales_y->at( $selected->at('SCALE_Y') ),
};
}
#method summarize_layout () {
# my $l = $self->layout;
#
# my $layout =
# [qw(panel row col)]->map( sub { $l->layout->at( uc( $_[0] ) ) } );
#
# my $facet_vars = $l->facet->vars();
#
# # Add a list-column of panel vars (for facets).
# #$layout->at('vars') =
#
# return $layout;
#}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Chart::GGPlot::Built - A processed ggplot that can be rendered
=head1 VERSION
version 0.002003
=head1 DESCRIPTION
This class represents a processed L<Chart::GGPlot::Plot> object that can
be rendered.
A L<Chart::GGPlot::Backend> consumer generates an object of this class as
an intermediate form during rendering a L<Chart::GGPlot::Plot> object.
( run in 1.384 second using v1.01-cache-2.11-cpan-39bf76dae61 )