« Chart/Plotly/Trace/Sankey/Legendgrouptitle/Font.pm
↑ Summary
Chart/Plotly/Trace/Sankey/Link/Hoverlabel/Font.pm »
| 1 | package Chart::Plotly::Trace::Sankey::Link::Concentrationscales; | ||
| 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 | our $VERSION = '0.042'; # VERSION | ||
| 10 | |||
| 11 | # ABSTRACT: This attribute is one of the possible options for the trace sankey. | ||
| 12 | |||
| 13 | sub TO_JSON { | ||
| 14 | my $self = shift; | ||
| 15 | my $extra_args = $self->extra_args // {}; | ||
| 16 | my $meta = $self->meta; | ||
| 17 | my %hash = %$self; | ||
| 18 | for my $name ( sort keys %hash ) { | ||
| 19 | my $attr = $meta->get_attribute($name); | ||
| 20 | if ( defined $attr ) { | ||
| 21 | my $value = $hash{$name}; | ||
| 22 | my $type = $attr->type_constraint; | ||
| 23 | if ( $type && $type->equals('Bool') ) { | ||
| 24 | $hash{$name} = $value ? \1 : \0; | ||
| 25 | } | ||
| 26 | } | ||
| 27 | } | ||
| 28 | %hash = ( %hash, %$extra_args ); | ||
| 29 | delete $hash{'extra_args'}; | ||
| 30 | if ( $self->can('type') && ( !defined $hash{'type'} ) ) { | ||
| 31 | $hash{type} = $self->type(); | ||
| 32 | } | ||
| 33 | return \%hash; | ||
| 34 | } | ||
| 35 | |||
| 36 | has cmax => ( is => "rw", | ||
| 37 | isa => "Num", | ||
| 38 | documentation => "Sets the upper bound of the color domain.", | ||
| 39 | ); | ||
| 40 | |||
| 41 | has cmin => ( is => "rw", | ||
| 42 | isa => "Num", | ||
| 43 | documentation => "Sets the lower bound of the color domain.", | ||
| 44 | ); | ||
| 45 | |||
| 46 | has colorscale => ( | ||
| 47 | is => "rw", | ||
| 48 | documentation => | ||
| 49 | "Sets the colorscale. 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 `cmin` and `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.", | ||
| 50 | ); | ||
| 51 | |||
| 52 | has label => ( is => "rw", | ||
| 53 | isa => "Str", | ||
| 54 | documentation => "The label of the links to color based on their concentration within a flow.", | ||
| 55 | ); | ||
| 56 | |||
| 57 | has name => ( | ||
| 58 | is => "rw", | ||
| 59 | isa => "Str", | ||
| 60 | documentation => | ||
| 61 | "When used in a template, named items are created in the output figure in addition to any items the figure already has in this array. You can modify these items in the output figure by making your own item with `templateitemname` matching this `name` alongside your modifications (including `visible: false` or `enabled: false` to hide it). Has no effect outside of a template.", | ||
| 62 | ); | ||
| 63 | |||
| 64 | has templateitemname => ( | ||
| 65 | is => "rw", | ||
| 66 | isa => "Str", | ||
| 67 | documentation => | ||
| 68 | "Used to refer to a named item in this array in the template. Named items from the template will be created even without a matching item in the input figure, but you can modify one by making an item with `templateitemname` matching its `name`, alongside your modifications (including `visible: false` or `enabled: false` to hide it). If there is no template or no matching item, this item will be hidden unless you explicitly show it with `visible: true`.", | ||
| 69 | ); | ||
| 70 | |||
| 71 | __PACKAGE__->meta->make_immutable(); | ||
| 72 | 1; | ||
| 73 | |||
| 74 | __END__ |