« Chart/Plotly/Trace/Icicle/Marker/Colorbar/Title.pm
↑ Summary
Chart/Plotly/Trace/Image/Hoverlabel.pm »
| 1 | package Chart::Plotly::Trace::Icicle::Pathbar; | ||
| 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::Icicle::Pathbar::Textfont; | ||
| 10 | |||
| 11 | our $VERSION = '0.042'; # VERSION | ||
| 12 | |||
| 13 | # ABSTRACT: This attribute is one of the possible options for the trace icicle. | ||
| 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 edgeshape => ( is => "rw", | ||
| 39 | isa => enum( [ ">", "<", "|", "/", "\\" ] ), | ||
| 40 | documentation => "Determines which shape is used for edges between `barpath` labels.", | ||
| 41 | ); | ||
| 42 | |||
| 43 | has side => ( is => "rw", | ||
| 44 | isa => enum( [ "top", "bottom" ] ), | ||
| 45 | documentation => "Determines on which side of the the treemap the `pathbar` should be presented.", | ||
| 46 | ); | ||
| 47 | |||
| 48 | has textfont => ( is => "rw", | ||
| 49 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Icicle::Pathbar::Textfont", ); | ||
| 50 | |||
| 51 | has thickness => ( | ||
| 52 | is => "rw", | ||
| 53 | isa => "Num", | ||
| 54 | documentation => | ||
| 55 | "Sets the thickness of `pathbar` (in px). If not specified the `pathbar.textfont.size` is used with 3 pixles extra padding on each side.", | ||
| 56 | ); | ||
| 57 | |||
| 58 | has visible => ( | ||
| 59 | is => "rw", | ||
| 60 | isa => "Bool", | ||
| 61 | documentation => "Determines if the path bar is drawn i.e. outside the trace `domain` and with one pixel gap.", | ||
| 62 | ); | ||
| 63 | |||
| 64 | __PACKAGE__->meta->make_immutable(); | ||
| 65 | 1; | ||
| 66 | |||
| 67 | __END__ |