« Chart/Plotly/Trace/Histogram2dcontour/Ybins/ImpliedEdits.pm
↑ Summary
Chart/Plotly/Trace/Icicle/Hoverlabel/Font.pm »
| 1 | package Chart::Plotly::Trace::Icicle::Domain; | ||
| 2 | use Moose; | ||
| 3 | use MooseX::ExtraArgs; | ||
| 4 | use Moose::Util::TypeConstraints qw(enum union); | ||
| 5 | if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) { | ||
| 6 | Moose::Util::TypeConstraints::type('PDL'); | ||
| 7 | } | ||
| 8 | |||
| 9 | our $VERSION = '0.042'; # VERSION | ||
| 10 | |||
| 11 | # ABSTRACT: This attribute is one of the possible options for the trace icicle. | ||
| 12 | |||
| 13 | sub TO_JSON { | ||
| 14 | my $self = shift; | ||
| 15 | my $extra_args = $self->extra_args // {}; | ||
| 16 | my $meta = $self->meta; | ||
| 17 | my %hash = %$self; | ||
| 18 | for my $name ( sort keys %hash ) { | ||
| 19 | my $attr = $meta->get_attribute($name); | ||
| 20 | if ( defined $attr ) { | ||
| 21 | my $value = $hash{$name}; | ||
| 22 | my $type = $attr->type_constraint; | ||
| 23 | if ( $type && $type->equals('Bool') ) { | ||
| 24 | $hash{$name} = $value ? \1 : \0; | ||
| 25 | } | ||
| 26 | } | ||
| 27 | } | ||
| 28 | %hash = ( %hash, %$extra_args ); | ||
| 29 | delete $hash{'extra_args'}; | ||
| 30 | if ( $self->can('type') && ( !defined $hash{'type'} ) ) { | ||
| 31 | $hash{type} = $self->type(); | ||
| 32 | } | ||
| 33 | return \%hash; | ||
| 34 | } | ||
| 35 | |||
| 36 | has column => ( | ||
| 37 | is => "rw", | ||
| 38 | isa => "Int", | ||
| 39 | documentation => "If there is a layout grid, use the domain for this column in the grid for this icicle trace .", | ||
| 40 | ); | ||
| 41 | |||
| 42 | has row => ( | ||
| 43 | is => "rw", | ||
| 44 | isa => "Int", | ||
| 45 | documentation => "If there is a layout grid, use the domain for this row in the grid for this icicle trace .", | ||
| 46 | ); | ||
| 47 | |||
| 48 | has x => ( is => "rw", | ||
| 49 | isa => "ArrayRef|PDL", | ||
| 50 | documentation => "Sets the horizontal domain of this icicle trace (in plot fraction).", | ||
| 51 | ); | ||
| 52 | |||
| 53 | has y => ( is => "rw", | ||
| 54 | isa => "ArrayRef|PDL", | ||
| 55 | documentation => "Sets the vertical domain of this icicle trace (in plot fraction).", | ||
| 56 | ); | ||
| 57 | |||
| 58 | __PACKAGE__->meta->make_immutable(); | ||
| 59 | 1; | ||
| 60 | |||
| 61 | __END__ |