Chart::Kaleido::Plotly - Export static images of Plotly charts using Kaleido
version 0.005
use Chart::Kaleido::Plotly; use JSON; my $kaleido = Chart::Kaleido::Plotly->new(); # convert a hashref my $data = decode_json(<<'END_OF_TEXT'); { "data": [{"y": [1,2,1]}] } END_OF_TEXT $kaleido->save( file => "foo.png", plot => $data, width => 1024, height => 768 ); # convert a Chart::Plotly::Plot object use Chart::Plotly::Plot; my $plot = Chart::Plotly::Plot->new( traces => [ Chart::Plotly::Trace::Scatter->new( x => [ 1 .. 5 ], y => [ 1 .. 5 ] ) ] ); $kaleido->save( file => "foo.png", plot => $plot, width => 1024, height => 768 );
This class wraps the "plotly" scope of plotly's kaleido command.
Path to plotly js file. Default value is plotly js bundled with Chart::Ploly.
Default is "png".
Default is 700.
Default is 500.
transform(( HashRef | InstanceOf["Chart::Plotly::Plot"] ) :$plot, Str :$format=$self->default_format, PositiveInt :$width=$self->default_width, PositiveInt :$height=$self->default_height, Num :$scale=1)
Returns raw image data.
save(:$file, ( HashRef | InstanceOf["Chart::Plotly::Plot"] ) :$plot, Optional[Str] :$format, PositiveInt :$width=$self->default_width, PositiveInt :$height=$self->default_height, Num :$scale=1)
Save static image to file.
https://github.com/plotly/Kaleido
Chart::Plotly, Chart::Kaleido, Alien::Plotly::Kaleido
Stephan Loyd <sloyd@cpan.org>
This software is copyright (c) 2020 by Stephan Loyd.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Chart::Kaleido, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Chart::Kaleido
CPAN shell
perl -MCPAN -e shell install Chart::Kaleido
For more information on module installation, please visit the detailed CPAN module installation guide.