| 1 | package Chart::GGPlot::Backend::Plotly::Geom::Polygon; | ||
| 2 | |||
| 3 | # ABSTRACT: Chart::GGPlot's Plotly implementation for Geom::Bar | ||
| 4 | |||
| 5 | use Chart::GGPlot::Class; | ||
| 6 | |||
| 7 | our $VERSION = '0.002003'; # VERSION | ||
| 8 | |||
| 9 | extends qw(Chart::GGPlot::Backend::Plotly::Geom::Line); | ||
| 10 | |||
| 11 | use PDL::Core qw(pdl); | ||
| 12 | use Module::Load; | ||
| 13 | |||
| 14 | use Chart::GGPlot::Backend::Plotly::Util qw( | ||
| 15 | to_px to_rgb group_to_NA pdl_to_plotly | ||
| 16 | ); | ||
| 17 | |||
| 18 | classmethod split_on () { [qw(fill color size)] } | ||
| 19 | classmethod hover_on () { 'fills' } | ||
| 20 | |||
| 21 | around to_traces ($orig, $class : $df, $params, $plot) { | ||
| 22 | my $traces = $class->$orig($df, $params, $plot); | ||
| 23 | for my $trace (@$traces) { | ||
| 24 | my $size = to_px( $df->at('size')->slice( pdl(0) ) )->at(0); | ||
| 25 | my $fillcolor = to_rgb( $df->at('fill'), $df->at('alpha') )->at(0); | ||
| 26 | $trace->text($df->at('hovertext')->at(0)); | ||
| 27 | $trace->line->width($size); | ||
| 28 | $trace->fill('toself'); | ||
| 29 | $trace->fillcolor($fillcolor); | ||
| 30 | } | ||
| 31 | return $traces; | ||
| 32 | } | ||
| 33 | |||
| 34 | __PACKAGE__->meta->make_immutable; | ||
| 35 | |||
| 36 | 1; | ||
| 37 | |||
| 38 | __END__ |