« Chart/Plotly/Trace/Scatterternary/Legendgrouptitle/Font.pm
↑ Summary
Chart/Plotly/Trace/Scatterternary/Marker/Colorbar/Tickfont.pm »
| 1 | package Chart::Plotly::Trace::Scatterternary::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 | our $VERSION = '0.042'; # VERSION | ||
| 10 | |||
| 11 | # ABSTRACT: This attribute is one of the possible options for the trace scatterternary. | ||
| 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 color => ( is => "rw", | ||
| 37 | isa => "Str", | ||
| 38 | documentation => "Sets the line color.", | ||
| 39 | ); | ||
| 40 | |||
| 41 | has dash => ( | ||
| 42 | is => "rw", | ||
| 43 | isa => "Str", | ||
| 44 | documentation => | ||
| 45 | "Sets the dash style of lines. Set to a dash type string (*solid*, *dot*, *dash*, *longdash*, *dashdot*, or *longdashdot*) or a dash length list in px (eg *5px,10px,2px,2px*).", | ||
| 46 | ); | ||
| 47 | |||
| 48 | has shape => ( | ||
| 49 | is => "rw", | ||
| 50 | isa => enum( [ "linear", "spline" ] ), | ||
| 51 | documentation => | ||
| 52 | "Determines the line shape. With *spline* the lines are drawn using spline interpolation. The other available values correspond to step-wise line shapes.", | ||
| 53 | ); | ||
| 54 | |||
| 55 | has smoothing => ( | ||
| 56 | is => "rw", | ||
| 57 | isa => "Num", | ||
| 58 | documentation => | ||
| 59 | "Has an effect only if `shape` is set to *spline* Sets the amount of smoothing. *0* corresponds to no smoothing (equivalent to a *linear* shape).", | ||
| 60 | ); | ||
| 61 | |||
| 62 | has width => ( is => "rw", | ||
| 63 | isa => "Num", | ||
| 64 | documentation => "Sets the line width (in px).", | ||
| 65 | ); | ||
| 66 | |||
| 67 | __PACKAGE__->meta->make_immutable(); | ||
| 68 | 1; | ||
| 69 | |||
| 70 | __END__ |