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