| 1 | package Chart::Plotly::Trace::Histogram::Error_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 | our $VERSION = '0.042'; # VERSION | ||
| 10 | |||
| 11 | # ABSTRACT: This attribute is one of the possible options for the trace histogram. | ||
| 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 copy_ystyle => ( is => "rw", | ||
| 66 | isa => "Bool", ); | ||
| 67 | |||
| 68 | has symmetric => ( | ||
| 69 | is => "rw", | ||
| 70 | isa => "Bool", | ||
| 71 | documentation => | ||
| 72 | "Determines whether or not the error bars have the same length in both direction (top/bottom for vertical bars, left/right for horizontal bars.", | ||
| 73 | ); | ||
| 74 | |||
| 75 | has thickness => ( is => "rw", | ||
| 76 | isa => "Num", | ||
| 77 | documentation => "Sets the thickness (in px) of the error bars.", | ||
| 78 | ); | ||
| 79 | |||
| 80 | has traceref => ( is => "rw", | ||
| 81 | isa => "Int", ); | ||
| 82 | |||
| 83 | has tracerefminus => ( is => "rw", | ||
| 84 | isa => "Int", ); | ||
| 85 | |||
| 86 | has value => ( | ||
| 87 | is => "rw", | ||
| 88 | isa => "Num", | ||
| 89 | documentation => | ||
| 90 | "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.", | ||
| 91 | ); | ||
| 92 | |||
| 93 | has valueminus => ( | ||
| 94 | is => "rw", | ||
| 95 | isa => "Num", | ||
| 96 | documentation => | ||
| 97 | "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", | ||
| 98 | ); | ||
| 99 | |||
| 100 | has visible => ( is => "rw", | ||
| 101 | isa => "Bool", | ||
| 102 | documentation => "Determines whether or not this set of error bars is visible.", | ||
| 103 | ); | ||
| 104 | |||
| 105 | has width => ( is => "rw", | ||
| 106 | isa => "Num", | ||
| 107 | documentation => "Sets the width (in px) of the cross-bar at both ends of the error bars.", | ||
| 108 | ); | ||
| 109 | |||
| 110 | __PACKAGE__->meta->make_immutable(); | ||
| 111 | 1; | ||
| 112 | |||
| 113 | __END__ |