NAME
Chart::Plotly::Plot
VERSION
version 0.038
SYNOPSIS
use Chart::Plotly::Trace::Scatter;
use Chart::Plotly::Plot;
use Chart::Plotly qw(show_plot);
use HTML::Show;
my $x = [1 .. 15];
my $y = [map {rand 10 } @$x];
my $scatter = Chart::Plotly::Trace::Scatter->new(x => $x, y => $y);
my $plot = Chart::Plotly::Plot->new();
$plot->add_trace($scatter);
show_plot($plot);
# This also works
# HTML::Show::show(Chart::Plotly::render_full_html(data => $plot));
# HTML::Show::show($plot->html);
DESCRIPTION
Represent a full plot composed of one or more traces (Chart::Plotly::Trace::*)
NAME
Chart::Plotly::Plot - Set of traces with their options and data
METHODS
config
Configuration options for the plot. See https://plot.ly/javascript/configuration-options/
html
Returns the html corresponding to the plot
Parameters
- div_id
- load_plotly_using_script_tag
-
Add the script tag neccesary for loading plotly.js. Default 1.
If plotly.js is going to be loaded in another place or some other way (e.g.: via RequireJS) is better to set to 0
TO_JSON
Returns the structure suitable to serialize to JSON corresponding to the plot.
This method is meant to be called by a JSON serializer, not directly.
Beware with nested data. For example piddle are still there and you're responsible to provide an appropiatte serializer. If you want the text representation of json use the method: to_json_text
to_json_text
Returns the plot serialized in JSON. Not suitable to use in nested structures. For nested structures you should check TO_JSON
from_json
Build the plot from a json string in the format returned by to_json_text.
Beware when using to_json_text and from_json the plot object can be slightly different (although the representation is the same). That is the reconstructed plot is equivalent to the first, for example when using PDL, piddles are serialized to simple arrays and when deserialized are just plain arrays.
AUTHOR
Pablo Rodríguez González
BUGS
Please report any bugs or feature requests via github: https://github.com/pablrod/p5-Chart-Plotly/issues
DISCLAIMER
This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly. But I think plotly.js is a great library and I want to use it with perl.
If you like plotly.js please consider supporting them purchasing a pro subscription: https://plot.ly/products/cloud/
LICENSE AND COPYRIGHT
Copyright 2016 Pablo Rodríguez González.
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AUTHOR
Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2020 by Pablo Rodríguez González.
This is free software, licensed under:
The MIT (X11) License