| 1 | package Chart::Plotly::Trace::Bar::Error_y; | ||
| 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 bar. | ||
| 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 array => ( | ||
| 37 | is => "rw", | ||
| 38 | isa => "ArrayRef|PDL", | ||
| 39 | documentation => | ||
| 40 | "Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data.", | ||
| 41 | ); | ||
| 42 | |||
| 43 | has arrayminus => ( | ||
| 44 | is => "rw", | ||
| 45 | isa => "ArrayRef|PDL", | ||
| 46 | documentation => | ||
| 47 | "Sets the data corresponding the length of each error bar in the bottom (left) direction for vertical (horizontal) bars Values are plotted relative to the underlying data.", | ||
| 48 | ); | ||
| 49 | |||
| 50 | has arrayminussrc => ( is => "rw", | ||
| 51 | isa => "Str", | ||
| 52 | documentation => "Sets the source reference on Chart Studio Cloud for `arrayminus`.", | ||
| 53 | ); | ||
| 54 | |||
| 55 | has arraysrc => ( is => "rw", | ||
| 56 | isa => "Str", | ||
| 57 | documentation => "Sets the source reference on Chart Studio Cloud for `array`.", | ||
| 58 | ); | ||
| 59 | |||
| 60 | has color => ( is => "rw", | ||
| 61 | isa => "Str", | ||
| 62 | documentation => "Sets the stoke color of the error bars.", | ||
| 63 | ); | ||
| 64 | |||
| 65 | has symmetric => ( | ||
| 66 | is => "rw", | ||
| 67 | isa => "Bool", | ||
| 68 | documentation => | ||
| 69 | "Determines whether or not the error bars have the same length in both direction (top/bottom for vertical bars, left/right for horizontal bars.", | ||
| 70 | ); | ||
| 71 | |||
| 72 | has thickness => ( is => "rw", | ||
| 73 | isa => "Num", | ||
| 74 | documentation => "Sets the thickness (in px) of the error bars.", | ||
| 75 | ); | ||
| 76 | |||
| 77 | has traceref => ( is => "rw", | ||
| 78 | isa => "Int", ); | ||
| 79 | |||
| 80 | has tracerefminus => ( is => "rw", | ||
| 81 | isa => "Int", ); | ||
| 82 | |||
| 83 | has value => ( | ||
| 84 | is => "rw", | ||
| 85 | isa => "Num", | ||
| 86 | documentation => | ||
| 87 | "Sets the value of either the percentage (if `type` is set to *percent*) or the constant (if `type` is set to *constant*) corresponding to the lengths of the error bars.", | ||
| 88 | ); | ||
| 89 | |||
| 90 | has valueminus => ( | ||
| 91 | is => "rw", | ||
| 92 | isa => "Num", | ||
| 93 | documentation => | ||
| 94 | "Sets the value of either the percentage (if `type` is set to *percent*) or the constant (if `type` is set to *constant*) corresponding to the lengths of the error bars in the bottom (left) direction for vertical (horizontal) bars", | ||
| 95 | ); | ||
| 96 | |||
| 97 | has visible => ( is => "rw", | ||
| 98 | isa => "Bool", | ||
| 99 | documentation => "Determines whether or not this set of error bars is visible.", | ||
| 100 | ); | ||
| 101 | |||
| 102 | has width => ( is => "rw", | ||
| 103 | isa => "Num", | ||
| 104 | documentation => "Sets the width (in px) of the cross-bar at both ends of the error bars.", | ||
| 105 | ); | ||
| 106 | |||
| 107 | __PACKAGE__->meta->make_immutable(); | ||
| 108 | 1; | ||
| 109 | |||
| 110 | __END__ |