| 1 | package Chart::Plotly::Trace::Splom::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::Splom::Marker::Colorbar; | ||
| 10 | use Chart::Plotly::Trace::Splom::Marker::Line; | ||
| 11 | |||
| 12 | our $VERSION = '0.042'; # VERSION | ||
| 13 | |||
| 14 | # ABSTRACT: This attribute is one of the possible options for the trace splom. | ||
| 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 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.", | ||
| 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 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.", | ||
| 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 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.", | ||
| 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 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`.", | ||
| 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 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.", | ||
| 72 | ); | ||
| 73 | |||
| 74 | has color => ( | ||
| 75 | is => "rw", | ||
| 76 | isa => "Str|ArrayRef[Str]", | ||
| 77 | documentation => | ||
| 78 | "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.", | ||
| 79 | ); | ||
| 80 | |||
| 81 | has coloraxis => ( | ||
| 82 | is => "rw", | ||
| 83 | documentation => | ||
| 84 | "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.", | ||
| 85 | ); | ||
| 86 | |||
| 87 | has colorbar => ( is => "rw", | ||
| 88 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Splom::Marker::Colorbar", ); | ||
| 89 | |||
| 90 | has colorscale => ( | ||
| 91 | is => "rw", | ||
| 92 | documentation => | ||
| 93 | "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.", | ||
| 94 | ); | ||
| 95 | |||
| 96 | has colorsrc => ( is => "rw", | ||
| 97 | isa => "Str", | ||
| 98 | documentation => "Sets the source reference on Chart Studio Cloud for `color`.", | ||
| 99 | ); | ||
| 100 | |||
| 101 | has line => ( is => "rw", | ||
| 102 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Splom::Marker::Line", ); | ||
| 103 | |||
| 104 | has opacity => ( is => "rw", | ||
| 105 | isa => "Num|ArrayRef[Num]", | ||
| 106 | documentation => "Sets the marker opacity.", | ||
| 107 | ); | ||
| 108 | |||
| 109 | has opacitysrc => ( is => "rw", | ||
| 110 | isa => "Str", | ||
| 111 | documentation => "Sets the source reference on Chart Studio Cloud for `opacity`.", | ||
| 112 | ); | ||
| 113 | |||
| 114 | has reversescale => ( | ||
| 115 | is => "rw", | ||
| 116 | isa => "Bool", | ||
| 117 | documentation => | ||
| 118 | "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.", | ||
| 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 in `marker.color` is set to a numerical array.", | ||
| 126 | ); | ||
| 127 | |||
| 128 | has size => ( is => "rw", | ||
| 129 | isa => "Num|ArrayRef[Num]", | ||
| 130 | documentation => "Sets the marker size (in px).", | ||
| 131 | ); | ||
| 132 | |||
| 133 | has sizemin => ( | ||
| 134 | is => "rw", | ||
| 135 | isa => "Num", | ||
| 136 | documentation => | ||
| 137 | "Has an effect only if `marker.size` is set to a numerical array. Sets the minimum size (in px) of the rendered marker points.", | ||
| 138 | ); | ||
| 139 | |||
| 140 | has sizemode => ( | ||
| 141 | is => "rw", | ||
| 142 | isa => enum( [ "diameter", "area" ] ), | ||
| 143 | documentation => | ||
| 144 | "Has an effect only if `marker.size` is set to a numerical array. Sets the rule for which the data in `size` is converted to pixels.", | ||
| 145 | ); | ||
| 146 | |||
| 147 | has sizeref => ( | ||
| 148 | is => "rw", | ||
| 149 | isa => "Num", | ||
| 150 | documentation => | ||
| 151 | "Has an effect only if `marker.size` is set to a numerical array. Sets the scale factor used to determine the rendered size of marker points. Use with `sizemin` and `sizemode`.", | ||
| 152 | ); | ||
| 153 | |||
| 154 | has sizesrc => ( is => "rw", | ||
| 155 | isa => "Str", | ||
| 156 | documentation => "Sets the source reference on Chart Studio Cloud for `size`.", | ||
| 157 | ); | ||
| 158 | |||
| 159 | has symbol => ( | ||
| 160 | is => "rw", | ||
| 161 | isa => "Maybe[ArrayRef]", | ||
| 162 | documentation => | ||
| 163 | "Sets the marker symbol type. Adding 100 is equivalent to appending *-open* to a symbol name. Adding 200 is equivalent to appending *-dot* to a symbol name. Adding 300 is equivalent to appending *-open-dot* or *dot-open* to a symbol name.", | ||
| 164 | ); | ||
| 165 | |||
| 166 | has symbolsrc => ( is => "rw", | ||
| 167 | isa => "Str", | ||
| 168 | documentation => "Sets the source reference on Chart Studio Cloud for `symbol`.", | ||
| 169 | ); | ||
| 170 | |||
| 171 | __PACKAGE__->meta->make_immutable(); | ||
| 172 | 1; | ||
| 173 | |||
| 174 | __END__ |