| 1 | package Chart::Plotly::Trace::Volume::Slices::Z; | ||
| 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 volume. | ||
| 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 fill => ( | ||
| 37 | is => "rw", | ||
| 38 | isa => "Num", | ||
| 39 | documentation => | ||
| 40 | "Sets the fill ratio of the `slices`. The default fill value of the `slices` is 1 meaning that they are entirely shaded. On the other hand Applying a `fill` ratio less than one would allow the creation of openings parallel to the edges.", | ||
| 41 | ); | ||
| 42 | |||
| 43 | has locations => ( | ||
| 44 | is => "rw", | ||
| 45 | isa => "ArrayRef|PDL", | ||
| 46 | documentation => | ||
| 47 | "Specifies the location(s) of slices on the axis. When not specified slices would be created for all points of the axis z except start and end.", | ||
| 48 | ); | ||
| 49 | |||
| 50 | has locationssrc => ( is => "rw", | ||
| 51 | isa => "Str", | ||
| 52 | documentation => "Sets the source reference on Chart Studio Cloud for `locations`.", | ||
| 53 | ); | ||
| 54 | |||
| 55 | has show => ( is => "rw", | ||
| 56 | isa => "Bool", | ||
| 57 | documentation => "Determines whether or not slice planes about the z dimension are drawn.", | ||
| 58 | ); | ||
| 59 | |||
| 60 | __PACKAGE__->meta->make_immutable(); | ||
| 61 | 1; | ||
| 62 | |||
| 63 | __END__ |