The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Chart::Kaleido::Plotly - Export static images of Plotly charts using Kaleido

VERSION

version 0.004

SYNOPSIS

    use Chart::Kaleido::Plotly;
    use JSON;

    my $data = decode_json(<<'END_OF_TEXT');
    { "data": [{"y": [1,2,1]}] }
    END_OF_TEXT

    my $kaleido = Chart::Kaleido::Plotly->new();
    $kaleido->save( file => "foo.png", plot => $data,
                    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

all_formats

Read-only class attribute. All supported formats.

METHODS

transform

    transform(( HashRef | InstanceOf["Chart::Plotly::Plot"] ) :$plot,
              Optional[Str] :$format,
              Int :$width, Int :$height, Num :$scale=1)

Returns raw image data.

save

    save(:$file,
         ( HashRef | InstanceOf["Chart::Plotly::Plot"] ) :$plot,
         Optional[Str] :$format,
         Int :$width, Int :$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 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.