Chart/Plotly/Trace/Histogram/Marker.pm untested

filter: Statementstmt 0.0% 0 / 55 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 86 CC 5 SCAR 26.9
CC
5
Cov
0%
TO_JSON
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 14.7
1 package Chart::Plotly::Trace::Histogram::Marker;
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::Marker::Colorbar;
10 use Chart::Plotly::Trace::Histogram::Marker::Line;
11 use Chart::Plotly::Trace::Histogram::Marker::Pattern;
12  
13 our $VERSION = '0.042'; # VERSION
14  
15 # ABSTRACT: This attribute is one of the possible options for the trace histogram.
16  
17 sub TO_JSON {
18 my $self = shift;
19 my $extra_args = $self->extra_args // {};
20 my $meta = $self->meta;
21 my %hash = %$self;
22 for my $name ( sort keys %hash ) {
23 my $attr = $meta->get_attribute($name);
24 if ( defined $attr ) {
25 my $value = $hash{$name};
26 my $type = $attr->type_constraint;
27 if ( $type && $type->equals('Bool') ) {
28 $hash{$name} = $value ? \1 : \0;
29 }
30 }
31 }
32 %hash = ( %hash, %$extra_args );
33 delete $hash{'extra_args'};
34 if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
35 $hash{type} = $self->type();
36 }
37 return \%hash;
38 }
39  
40 has autocolorscale => (
41 is => "rw",
42 isa => "Bool",
43 documentation =>
44 "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `marker.colorscale`. Has an effect only if in `marker.color` is set to a numerical array. In case `colorscale` is unspecified or `autocolorscale` is true, the default palette will be chosen according to whether numbers in the `color` array are all positive, all negative or mixed.",
45 );
46  
47 has cauto => (
48 is => "rw",
49 isa => "Bool",
50 documentation =>
51 "Determines whether or not the color domain is computed with respect to the input data (here in `marker.color`) or the bounds set in `marker.cmin` and `marker.cmax` Has an effect only if in `marker.color` is set to a numerical array. Defaults to `false` when `marker.cmin` and `marker.cmax` are set by the user.",
52 );
53  
54 has cmax => (
55 is => "rw",
56 isa => "Num",
57 documentation =>
58 "Sets the upper bound of the color domain. Has an effect only if in `marker.color` is set to a numerical array. Value should have the same units as in `marker.color` and if set, `marker.cmin` must be set as well.",
59 );
60  
61 has cmid => (
62 is => "rw",
63 isa => "Num",
64 documentation =>
65 "Sets the mid-point of the color domain by scaling `marker.cmin` and/or `marker.cmax` to be equidistant to this point. Has an effect only if in `marker.color` is set to a numerical array. Value should have the same units as in `marker.color`. Has no effect when `marker.cauto` is `false`.",
66 );
67  
68 has cmin => (
69 is => "rw",
70 isa => "Num",
71 documentation =>
72 "Sets the lower bound of the color domain. Has an effect only if in `marker.color` is set to a numerical array. Value should have the same units as in `marker.color` and if set, `marker.cmax` must be set as well.",
73 );
74  
75 has color => (
76 is => "rw",
77 isa => "Str|ArrayRef[Str]",
78 documentation =>
79 "Sets the marker color. It accepts either a specific color or an array of numbers that are mapped to the colorscale relative to the max and min values of the array or relative to `marker.cmin` and `marker.cmax` if set.",
80 );
81  
82 has coloraxis => (
83 is => "rw",
84 documentation =>
85 "Sets a reference to a shared color axis. References to these shared color axes are *coloraxis*, *coloraxis2*, *coloraxis3*, etc. Settings for these shared color axes are set in the layout, under `layout.coloraxis`, `layout.coloraxis2`, etc. Note that multiple color scales can be linked to the same color axis.",
86 );
87  
88 has colorbar => ( is => "rw",
89 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Histogram::Marker::Colorbar", );
90  
91 has colorscale => (
92 is => "rw",
93 documentation =>
94 "Sets the colorscale. Has an effect only if in `marker.color` is set to a numerical array. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)'], [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in color space, use `marker.cmin` and `marker.cmax`. Alternatively, `colorscale` may be a palette name string of the following list: Blackbody,Bluered,Blues,Cividis,Earth,Electric,Greens,Greys,Hot,Jet,Picnic,Portland,Rainbow,RdBu,Reds,Viridis,YlGnBu,YlOrRd.",
95 );
96  
97 has colorsrc => ( is => "rw",
98 isa => "Str",
99 documentation => "Sets the source reference on Chart Studio Cloud for `color`.",
100 );
101  
102 has line => ( is => "rw",
103 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Histogram::Marker::Line", );
104  
105 has opacity => ( is => "rw",
106 isa => "Num|ArrayRef[Num]",
107 documentation => "Sets the opacity of the bars.",
108 );
109  
110 has opacitysrc => ( is => "rw",
111 isa => "Str",
112 documentation => "Sets the source reference on Chart Studio Cloud for `opacity`.",
113 );
114  
115 has pattern => ( is => "rw",
116 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Histogram::Marker::Pattern", );
117  
118 has reversescale => (
119 is => "rw",
120 isa => "Bool",
121 documentation =>
122 "Reverses the color mapping if true. Has an effect only if in `marker.color` is set to a numerical array. If true, `marker.cmin` will correspond to the last color in the array and `marker.cmax` will correspond to the first color.",
123 );
124  
125 has showscale => (
126 is => "rw",
127 isa => "Bool",
128 documentation =>
129 "Determines whether or not a colorbar is displayed for this trace. Has an effect only if in `marker.color` is set to a numerical array.",
130 );
131  
132 __PACKAGE__->meta->make_immutable();
133 1;
134  
135 __END__