| 1 | package Chart::Plotly::Trace::Treemap::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::Treemap::Marker::Colorbar; | ||
| 10 | use Chart::Plotly::Trace::Treemap::Marker::Line; | ||
| 11 | use Chart::Plotly::Trace::Treemap::Marker::Pad; | ||
| 12 | |||
| 13 | our $VERSION = '0.042'; # VERSION | ||
| 14 | |||
| 15 | # ABSTRACT: This attribute is one of the possible options for the trace treemap. | ||
| 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 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.", | ||
| 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 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.", | ||
| 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 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.", | ||
| 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 colors is set to a numerical array. Value should have the same units as colors. 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 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.", | ||
| 73 | ); | ||
| 74 | |||
| 75 | has coloraxis => ( | ||
| 76 | is => "rw", | ||
| 77 | documentation => | ||
| 78 | "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.", | ||
| 79 | ); | ||
| 80 | |||
| 81 | has colorbar => ( is => "rw", | ||
| 82 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Treemap::Marker::Colorbar", ); | ||
| 83 | |||
| 84 | has colors => ( | ||
| 85 | is => "rw", | ||
| 86 | isa => "ArrayRef|PDL", | ||
| 87 | documentation => | ||
| 88 | "Sets the color of each sector of this trace. If not specified, the default trace color set is used to pick the sector colors.", | ||
| 89 | ); | ||
| 90 | |||
| 91 | has colorscale => ( | ||
| 92 | is => "rw", | ||
| 93 | documentation => | ||
| 94 | "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.", | ||
| 95 | ); | ||
| 96 | |||
| 97 | has colorssrc => ( is => "rw", | ||
| 98 | isa => "Str", | ||
| 99 | documentation => "Sets the source reference on Chart Studio Cloud for `colors`.", | ||
| 100 | ); | ||
| 101 | |||
| 102 | has depthfade => ( | ||
| 103 | is => "rw", | ||
| 104 | documentation => | ||
| 105 | "Determines if the sector colors are faded towards the background from the leaves up to the headers. This option is unavailable when a `colorscale` is present, defaults to false when `marker.colors` is set, but otherwise defaults to true. When set to *reversed*, the fading direction is inverted, that is the top elements within hierarchy are drawn with fully saturated colors while the leaves are faded towards the background color.", | ||
| 106 | ); | ||
| 107 | |||
| 108 | has line => ( is => "rw", | ||
| 109 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Treemap::Marker::Line", ); | ||
| 110 | |||
| 111 | has pad => ( is => "rw", | ||
| 112 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Treemap::Marker::Pad", ); | ||
| 113 | |||
| 114 | has reversescale => ( | ||
| 115 | is => "rw", | ||
| 116 | isa => "Bool", | ||
| 117 | documentation => | ||
| 118 | "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.", | ||
| 119 | ); | ||
| 120 | |||
| 121 | has showscale => ( | ||
| 122 | is => "rw", | ||
| 123 | isa => "Bool", | ||
| 124 | documentation => | ||
| 125 | "Determines whether or not a colorbar is displayed for this trace. Has an effect only if colors is set to a numerical array.", | ||
| 126 | ); | ||
| 127 | |||
| 128 | __PACKAGE__->meta->make_immutable(); | ||
| 129 | 1; | ||
| 130 | |||
| 131 | __END__ |