NAME
Chart::Kaleido::Plotly - Export static images of Plotly charts using Kaleido
VERSION
version 0.014
SYNOPSIS
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 );
DESCRIPTION
This class wraps the "plotly" scope of plotly's kaleido command.
ATTRIBUTES
timeout
plotlyjs
Path to plotly js file. Default value is plotly js bundled with Chart::Ploly.
mathjax
topojson
mapbox_access_token
default_format
Default is "png".
default_width
Default is 700.
default_height
Default is 500.
METHODS
transform
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
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.
SEE ALSO
https://github.com/plotly/Kaleido
Chart::Plotly, Chart::Kaleido, Alien::Plotly::Kaleido
AUTHOR
Stephan Loyd <sloyd@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020-2023 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.