| 1 | package Chart::Plotly::Trace::Surface::Contours::X; | ||
| 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::Surface::Contours::X::Project; | ||
| 10 | |||
| 11 | our $VERSION = '0.042'; # VERSION | ||
| 12 | |||
| 13 | # ABSTRACT: This attribute is one of the possible options for the trace surface. | ||
| 14 | |||
| 15 | sub TO_JSON { | ||
| 16 | my $self = shift; | ||
| 17 | my $extra_args = $self->extra_args // {}; | ||
| 18 | my $meta = $self->meta; | ||
| 19 | my %hash = %$self; | ||
| 20 | for my $name ( sort keys %hash ) { | ||
| 21 | my $attr = $meta->get_attribute($name); | ||
| 22 | if ( defined $attr ) { | ||
| 23 | my $value = $hash{$name}; | ||
| 24 | my $type = $attr->type_constraint; | ||
| 25 | if ( $type && $type->equals('Bool') ) { | ||
| 26 | $hash{$name} = $value ? \1 : \0; | ||
| 27 | } | ||
| 28 | } | ||
| 29 | } | ||
| 30 | %hash = ( %hash, %$extra_args ); | ||
| 31 | delete $hash{'extra_args'}; | ||
| 32 | if ( $self->can('type') && ( !defined $hash{'type'} ) ) { | ||
| 33 | $hash{type} = $self->type(); | ||
| 34 | } | ||
| 35 | return \%hash; | ||
| 36 | } | ||
| 37 | |||
| 38 | has color => ( is => "rw", | ||
| 39 | isa => "Str", | ||
| 40 | documentation => "Sets the color of the contour lines.", | ||
| 41 | ); | ||
| 42 | |||
| 43 | has end => ( is => "rw", | ||
| 44 | isa => "Num", | ||
| 45 | documentation => "Sets the end contour level value. Must be more than `contours.start`", | ||
| 46 | ); | ||
| 47 | |||
| 48 | has highlight => ( | ||
| 49 | is => "rw", | ||
| 50 | isa => "Bool", | ||
| 51 | documentation => "Determines whether or not contour lines about the x dimension are highlighted on hover.", | ||
| 52 | ); | ||
| 53 | |||
| 54 | has highlightcolor => ( is => "rw", | ||
| 55 | isa => "Str", | ||
| 56 | documentation => "Sets the color of the highlighted contour lines.", | ||
| 57 | ); | ||
| 58 | |||
| 59 | has highlightwidth => ( is => "rw", | ||
| 60 | isa => "Num", | ||
| 61 | documentation => "Sets the width of the highlighted contour lines.", | ||
| 62 | ); | ||
| 63 | |||
| 64 | has project => ( is => "rw", | ||
| 65 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Surface::Contours::X::Project", ); | ||
| 66 | |||
| 67 | has show => ( is => "rw", | ||
| 68 | isa => "Bool", | ||
| 69 | documentation => "Determines whether or not contour lines about the x dimension are drawn.", | ||
| 70 | ); | ||
| 71 | |||
| 72 | has size => ( is => "rw", | ||
| 73 | isa => "Num", | ||
| 74 | documentation => "Sets the step between each contour level. Must be positive.", | ||
| 75 | ); | ||
| 76 | |||
| 77 | has start => ( is => "rw", | ||
| 78 | isa => "Num", | ||
| 79 | documentation => "Sets the starting contour level value. Must be less than `contours.end`", | ||
| 80 | ); | ||
| 81 | |||
| 82 | has usecolormap => ( | ||
| 83 | is => "rw", | ||
| 84 | isa => "Bool", | ||
| 85 | documentation => | ||
| 86 | "An alternate to *color*. Determines whether or not the contour lines are colored using the trace *colorscale*.", | ||
| 87 | ); | ||
| 88 | |||
| 89 | has width => ( is => "rw", | ||
| 90 | isa => "Num", | ||
| 91 | documentation => "Sets the width of the contour lines.", | ||
| 92 | ); | ||
| 93 | |||
| 94 | __PACKAGE__->meta->make_immutable(); | ||
| 95 | 1; | ||
| 96 | |||
| 97 | __END__ |