« Chart/Plotly/Trace/Histogram2dcontour/Contours.pm
↑ Summary
Chart/Plotly/Trace/Indicator/Gauge/Axis.pm »
| 1 | package Chart::Plotly::Trace::Icicle::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::Icicle::Marker::Colorbar; | ||
| 10 | use Chart::Plotly::Trace::Icicle::Marker::Line; | ||
| 11 | |||
| 12 | our $VERSION = '0.042'; # VERSION | ||
| 13 | |||
| 14 | # ABSTRACT: This attribute is one of the possible options for the trace icicle. | ||
| 15 | |||
| 16 | sub TO_JSON { | ||
| 17 | my $self = shift; | ||
| 18 | my $extra_args = $self->extra_args // {}; | ||
| 19 | my $meta = $self->meta; | ||
| 20 | my %hash = %$self; | ||
| 21 | for my $name ( sort keys %hash ) { | ||
| 22 | my $attr = $meta->get_attribute($name); | ||
| 23 | if ( defined $attr ) { | ||
| 24 | my $value = $hash{$name}; | ||
| 25 | my $type = $attr->type_constraint; | ||
| 26 | if ( $type && $type->equals('Bool') ) { | ||
| 27 | $hash{$name} = $value ? \1 : \0; | ||
| 28 | } | ||
| 29 | } | ||
| 30 | } | ||
| 31 | %hash = ( %hash, %$extra_args ); | ||
| 32 | delete $hash{'extra_args'}; | ||
| 33 | if ( $self->can('type') && ( !defined $hash{'type'} ) ) { | ||
| 34 | $hash{type} = $self->type(); | ||
| 35 | } | ||
| 36 | return \%hash; | ||
| 37 | } | ||
| 38 | |||
| 39 | has autocolorscale => ( | ||
| 40 | is => "rw", | ||
| 41 | isa => "Bool", | ||
| 42 | documentation => | ||
| 43 | "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `marker.colorscale`. Has an effect only if colors 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.", | ||
| 44 | ); | ||
| 45 | |||
| 46 | has cauto => ( | ||
| 47 | is => "rw", | ||
| 48 | isa => "Bool", | ||
| 49 | documentation => | ||
| 50 | "Determines whether or not the color domain is computed with respect to the input data (here colors) or the bounds set in `marker.cmin` and `marker.cmax` Has an effect only if colors is set to a numerical array. Defaults to `false` when `marker.cmin` and `marker.cmax` are set by the user.", | ||
| 51 | ); | ||
| 52 | |||
| 53 | has cmax => ( | ||
| 54 | is => "rw", | ||
| 55 | isa => "Num", | ||
| 56 | documentation => | ||
| 57 | "Sets the upper bound of the color domain. Has an effect only if colors is set to a numerical array. Value should have the same units as colors and if set, `marker.cmin` must be set as well.", | ||
| 58 | ); | ||
| 59 | |||
| 60 | has cmid => ( | ||
| 61 | is => "rw", | ||
| 62 | isa => "Num", | ||
| 63 | documentation => | ||
| 64 | "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 colors is set to a numerical array. Value should have the same units as colors. Has no effect when `marker.cauto` is `false`.", | ||
| 65 | ); | ||
| 66 | |||
| 67 | has cmin => ( | ||
| 68 | is => "rw", | ||
| 69 | isa => "Num", | ||
| 70 | documentation => | ||
| 71 | "Sets the lower bound of the color domain. Has an effect only if colors is set to a numerical array. Value should have the same units as colors and if set, `marker.cmax` must be set as well.", | ||
| 72 | ); | ||
| 73 | |||
| 74 | has coloraxis => ( | ||
| 75 | is => "rw", | ||
| 76 | documentation => | ||
| 77 | "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.", | ||
| 78 | ); | ||
| 79 | |||
| 80 | has colorbar => ( is => "rw", | ||
| 81 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Icicle::Marker::Colorbar", ); | ||
| 82 | |||
| 83 | has colors => ( | ||
| 84 | is => "rw", | ||
| 85 | isa => "ArrayRef|PDL", | ||
| 86 | documentation => | ||
| 87 | "Sets the color of each sector of this trace. If not specified, the default trace color set is used to pick the sector colors.", | ||
| 88 | ); | ||
| 89 | |||
| 90 | has colorscale => ( | ||
| 91 | is => "rw", | ||
| 92 | documentation => | ||
| 93 | "Sets the colorscale. Has an effect only if colors 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.", | ||
| 94 | ); | ||
| 95 | |||
| 96 | has colorssrc => ( is => "rw", | ||
| 97 | isa => "Str", | ||
| 98 | documentation => "Sets the source reference on Chart Studio Cloud for `colors`.", | ||
| 99 | ); | ||
| 100 | |||
| 101 | has line => ( is => "rw", | ||
| 102 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Icicle::Marker::Line", ); | ||
| 103 | |||
| 104 | has reversescale => ( | ||
| 105 | is => "rw", | ||
| 106 | isa => "Bool", | ||
| 107 | documentation => | ||
| 108 | "Reverses the color mapping if true. Has an effect only if colors 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.", | ||
| 109 | ); | ||
| 110 | |||
| 111 | has showscale => ( | ||
| 112 | is => "rw", | ||
| 113 | isa => "Bool", | ||
| 114 | documentation => | ||
| 115 | "Determines whether or not a colorbar is displayed for this trace. Has an effect only if colors is set to a numerical array.", | ||
| 116 | ); | ||
| 117 | |||
| 118 | __PACKAGE__->meta->make_immutable(); | ||
| 119 | 1; | ||
| 120 | |||
| 121 | __END__ |