« Chart/Plotly/Trace/Histogram/Selected.pm
↑ Summary
Chart/Plotly/Trace/Histogram2dcontour/Contours.pm »
| 1 | package Chart::Plotly::Trace::Histogram::Unselected; | ||
| 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 | use Chart::Plotly::Trace::Histogram::Unselected::Marker; | ||
| 10 | use Chart::Plotly::Trace::Histogram::Unselected::Textfont; | ||
| 11 | |||
| 12 | our $VERSION = '0.042'; # VERSION | ||
| 13 | |||
| 14 | # ABSTRACT: This attribute is one of the possible options for the trace histogram. | ||
| 15 | |||
| 16 | sub TO_JSON { | ||
| 17 | my $self = shift; | ||
| 18 | my $extra_args = $self->extra_args // {}; | ||
| 19 | my $meta = $self->meta; | ||
| 20 | my %hash = %$self; | ||
| 21 | for my $name ( sort keys %hash ) { | ||
| 22 | my $attr = $meta->get_attribute($name); | ||
| 23 | if ( defined $attr ) { | ||
| 24 | my $value = $hash{$name}; | ||
| 25 | my $type = $attr->type_constraint; | ||
| 26 | if ( $type && $type->equals('Bool') ) { | ||
| 27 | $hash{$name} = $value ? \1 : \0; | ||
| 28 | } | ||
| 29 | } | ||
| 30 | } | ||
| 31 | %hash = ( %hash, %$extra_args ); | ||
| 32 | delete $hash{'extra_args'}; | ||
| 33 | if ( $self->can('type') && ( !defined $hash{'type'} ) ) { | ||
| 34 | $hash{type} = $self->type(); | ||
| 35 | } | ||
| 36 | return \%hash; | ||
| 37 | } | ||
| 38 | |||
| 39 | has marker => ( is => "rw", | ||
| 40 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Histogram::Unselected::Marker", ); | ||
| 41 | |||
| 42 | has textfont => ( is => "rw", | ||
| 43 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Histogram::Unselected::Textfont", ); | ||
| 44 | |||
| 45 | __PACKAGE__->meta->make_immutable(); | ||
| 46 | 1; | ||
| 47 | |||
| 48 | __END__ |