« Chart/Plotly/Trace/Choroplethmapbox/Unselected.pm
↑ Summary
Chart/Plotly/Trace/Cone/Hoverlabel.pm »
| 1 | package Chart::Plotly::Trace::Cone::Colorbar::Title; | ||
| 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::Cone::Colorbar::Title::Font; | ||
| 10 | |||
| 11 | our $VERSION = '0.042'; # VERSION | ||
| 12 | |||
| 13 | # ABSTRACT: This attribute is one of the possible options for the trace cone. | ||
| 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 font => ( is => "rw", | ||
| 39 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Cone::Colorbar::Title::Font", ); | ||
| 40 | |||
| 41 | has side => ( | ||
| 42 | is => "rw", | ||
| 43 | isa => enum( [ "right", "top", "bottom" ] ), | ||
| 44 | documentation => | ||
| 45 | "Determines the location of color bar's title with respect to the color bar. Defaults to *top* when `orientation` if *v* and defaults to *right* when `orientation` if *h*. Note that the title's location used to be set by the now deprecated `titleside` attribute.", | ||
| 46 | ); | ||
| 47 | |||
| 48 | has text => ( | ||
| 49 | is => "rw", | ||
| 50 | isa => "Str", | ||
| 51 | documentation => | ||
| 52 | "Sets the title of the color bar. Note that before the existence of `title.text`, the title's contents used to be defined as the `title` attribute itself. This behavior has been deprecated.", | ||
| 53 | ); | ||
| 54 | |||
| 55 | __PACKAGE__->meta->make_immutable(); | ||
| 56 | 1; | ||
| 57 | |||
| 58 | __END__ |