| 1 | package Chart::GGPlot::Backend::Plotly::Geom::Point; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: Chart::GGPlot's Plotly implementation for Geom::Point | ||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Chart::GGPlot::Class; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | our $VERSION = '0.002003'; # VERSION | |||||||||
| 8 | |||||||||||
| 9 | 1 | extends qw(Chart::GGPlot::Backend::Plotly::Geom::Path); | |||||||||
| 10 | |||||||||||
| 11 | 1 | ▶ | use Module::Load; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 1 | ▶ | use Chart::GGPlot::Backend::Plotly::Util qw(to_px to_rgb pdl_to_plotly); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 1 | ▶ | use Chart::GGPlot::Util qw(ifelse); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 0 | ▶ | sub mode { | ||||||||
|
Subroutine
mode: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 17 | 0 | return 'markers'; | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | classmethod scatter_marker ($df, $params, @rest) { | ||||||||
|
Subroutine
scatter_marker: not called CC=4 SCAR=30.0
Pod
undocumented
Branch: 1 branch
| |||||||||||
| 21 | 0 | my $color = to_rgb( $df->at('color') ); | |||||||||
| 22 | 0 | ▶ | my $fill = | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | $df->exists('fill') | ||||||||||
| 24 | ? ifelse( $df->at('fill')->isbad, $color, to_rgb( $df->at('fill') ) ) | ||||||||||
| 25 | : $color; | ||||||||||
| 26 | 0 | my $size = to_px( $df->at('size') ); | |||||||||
| 27 | 0 | $size->where($size < 2) .= 2; | |||||||||
| 28 | 0 | my $opacity = $df->at('alpha')->setbadtoval(1); | |||||||||
| 29 | 0 | my $stroke = to_px( $df->at('stroke') ); | |||||||||
| 30 | |||||||||||
| 31 | 0 | my $use_webgl = $class->use_webgl($df); | |||||||||
| 32 | 0 | ▶ | my $plotly_trace_class = | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | $use_webgl | ||||||||||
| 34 | ? 'Chart::Plotly::Trace::Scattergl' | ||||||||||
| 35 | : 'Chart::Plotly::Trace::Scatter'; | ||||||||||
| 36 | 0 | my $plotly_marker_class = "${plotly_trace_class}::Marker"; | |||||||||
| 37 | |||||||||||
| 38 | 0 | load $plotly_marker_class; | |||||||||
| 39 | |||||||||||
| 40 | 0 | return $plotly_marker_class->new( | |||||||||
| 41 | color => pdl_to_plotly( $fill, true ), | ||||||||||
| 42 | size => pdl_to_plotly( $size, true ), | ||||||||||
| 43 | line => { | ||||||||||
| 44 | color => pdl_to_plotly( $color, true ), | ||||||||||
| 45 | width => pdl_to_plotly( $stroke, true ), | ||||||||||
| 46 | }, | ||||||||||
| 47 | |||||||||||
| 48 | # TODO: support scatter symbol | ||||||||||
| 49 | symbol => [ (0) x $df->at('size')->length ], | ||||||||||
| 50 | opacity => pdl_to_plotly( $opacity, true ), | ||||||||||
| 51 | ); | ||||||||||
| 52 | 1 | } | |||||||||
| 53 | |||||||||||
| 54 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 55 | |||||||||||
| 56 | 1 | 1; | |||||||||
| 57 | |||||||||||
| 58 | __END__ | ||||||||||