« Chart/Plotly/Trace/Barpolar/Unselected.pm
↑ Summary
Chart/Plotly/Trace/Contourcarpet/Contours.pm »
| 1 | package Chart::Plotly::Trace::Contour::Contours; | ||
| 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::Contour::Contours::ImpliedEdits; | ||
| 10 | use Chart::Plotly::Trace::Contour::Contours::Labelfont; | ||
| 11 | |||
| 12 | our $VERSION = '0.042'; # VERSION | ||
| 13 | |||
| 14 | # ABSTRACT: This attribute is one of the possible options for the trace contour. | ||
| 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 coloring => ( | ||
| 40 | is => "rw", | ||
| 41 | isa => enum( [ "fill", "heatmap", "lines", "none" ] ), | ||
| 42 | documentation => | ||
| 43 | "Determines the coloring method showing the contour values. If *fill*, coloring is done evenly between each contour level If *heatmap*, a heatmap gradient coloring is applied between each contour level. If *lines*, coloring is done on the contour lines. If *none*, no coloring is applied on this trace.", | ||
| 44 | ); | ||
| 45 | |||
| 46 | has end => ( is => "rw", | ||
| 47 | isa => "Num", | ||
| 48 | documentation => "Sets the end contour level value. Must be more than `contours.start`", | ||
| 49 | ); | ||
| 50 | |||
| 51 | has impliedEdits => ( is => "rw", | ||
| 52 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Contour::Contours::ImpliedEdits", ); | ||
| 53 | |||
| 54 | has labelfont => ( is => "rw", | ||
| 55 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Contour::Contours::Labelfont", ); | ||
| 56 | |||
| 57 | has labelformat => ( | ||
| 58 | is => "rw", | ||
| 59 | isa => "Str", | ||
| 60 | documentation => | ||
| 61 | "Sets the contour label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format.", | ||
| 62 | ); | ||
| 63 | |||
| 64 | has operation => ( | ||
| 65 | is => "rw", | ||
| 66 | isa => enum( [ "=", "<", ">=", ">", "<=", "[]", "()", "[)", "(]", "][", ")(", "](", ")[" ] ), | ||
| 67 | documentation => | ||
| 68 | "Sets the constraint operation. *=* keeps regions equal to `value` *<* and *<=* keep regions less than `value` *>* and *>=* keep regions greater than `value` *[]*, *()*, *[)*, and *(]* keep regions inside `value[0]` to `value[1]` *][*, *)(*, *](*, *)[* keep regions outside `value[0]` to value[1]` Open vs. closed intervals make no difference to constraint display, but all versions are allowed for consistency with filter transforms.", | ||
| 69 | ); | ||
| 70 | |||
| 71 | has showlabels => ( is => "rw", | ||
| 72 | isa => "Bool", | ||
| 73 | documentation => "Determines whether to label the contour lines with their values.", | ||
| 74 | ); | ||
| 75 | |||
| 76 | has showlines => ( | ||
| 77 | is => "rw", | ||
| 78 | isa => "Bool", | ||
| 79 | documentation => | ||
| 80 | "Determines whether or not the contour lines are drawn. Has an effect only if `contours.coloring` is set to *fill*.", | ||
| 81 | ); | ||
| 82 | |||
| 83 | has size => ( is => "rw", | ||
| 84 | isa => "Num", | ||
| 85 | documentation => "Sets the step between each contour level. Must be positive.", | ||
| 86 | ); | ||
| 87 | |||
| 88 | has start => ( is => "rw", | ||
| 89 | isa => "Num", | ||
| 90 | documentation => "Sets the starting contour level value. Must be less than `contours.end`", | ||
| 91 | ); | ||
| 92 | |||
| 93 | has value => ( | ||
| 94 | is => "rw", | ||
| 95 | isa => "Any", | ||
| 96 | documentation => | ||
| 97 | "Sets the value or values of the constraint boundary. When `operation` is set to one of the comparison values (=,<,>=,>,<=) *value* is expected to be a number. When `operation` is set to one of the interval values ([],(),[),(],][,)(,](,)[) *value* is expected to be an array of two numbers where the first is the lower bound and the second is the upper bound.", | ||
| 98 | ); | ||
| 99 | |||
| 100 | __PACKAGE__->meta->make_immutable(); | ||
| 101 | 1; | ||
| 102 | |||
| 103 | __END__ |