« Chart/Plotly/Trace/Pointcloud/Legendgrouptitle.pm
↑ Summary
Chart/Plotly/Trace/Sankey/Hoverlabel.pm »
| 1 | package Chart::Plotly::Trace::Pointcloud::Marker; | ||
| 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::Pointcloud::Marker::Border; | ||
| 10 | |||
| 11 | our $VERSION = '0.042'; # VERSION | ||
| 12 | |||
| 13 | # ABSTRACT: This attribute is one of the possible options for the trace pointcloud. | ||
| 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 blend => ( | ||
| 39 | is => "rw", | ||
| 40 | isa => "Bool", | ||
| 41 | documentation => | ||
| 42 | "Determines if colors are blended together for a translucency effect in case `opacity` is specified as a value less then `1`. Setting `blend` to `true` reduces zoom/pan speed if used with large numbers of points.", | ||
| 43 | ); | ||
| 44 | |||
| 45 | has border => ( is => "rw", | ||
| 46 | isa => "Maybe[HashRef]|Chart::Plotly::Trace::Pointcloud::Marker::Border", ); | ||
| 47 | |||
| 48 | has color => ( | ||
| 49 | is => "rw", | ||
| 50 | isa => "Str", | ||
| 51 | documentation => | ||
| 52 | "Sets the marker fill color. It accepts a specific color. If the color is not fully opaque and there are hundreds of thousands of points, it may cause slower zooming and panning.", | ||
| 53 | ); | ||
| 54 | |||
| 55 | has opacity => ( | ||
| 56 | is => "rw", | ||
| 57 | isa => "Num", | ||
| 58 | documentation => | ||
| 59 | "Sets the marker opacity. The default value is `1` (fully opaque). If the markers are not fully opaque and there are hundreds of thousands of points, it may cause slower zooming and panning. Opacity fades the color even if `blend` is left on `false` even if there is no translucency effect in that case.", | ||
| 60 | ); | ||
| 61 | |||
| 62 | has sizemax => ( | ||
| 63 | is => "rw", | ||
| 64 | isa => "Num", | ||
| 65 | documentation => | ||
| 66 | "Sets the maximum size (in px) of the rendered marker points. Effective when the `pointcloud` shows only few points.", | ||
| 67 | ); | ||
| 68 | |||
| 69 | has sizemin => ( | ||
| 70 | is => "rw", | ||
| 71 | isa => "Num", | ||
| 72 | documentation => | ||
| 73 | "Sets the minimum size (in px) of the rendered marker points, effective when the `pointcloud` shows a million or more points.", | ||
| 74 | ); | ||
| 75 | |||
| 76 | __PACKAGE__->meta->make_immutable(); | ||
| 77 | 1; | ||
| 78 | |||
| 79 | __END__ |