package Chart::Plotly::Plot;
use Moose;
use JSON qw();
use utf8;
use UUID::Tiny ':std';
our $VERSION = '0.042'; # VERSION
use Chart::Plotly;
has traces => ( traits => ['Array'],
sub TO_JSON {
my $self = shift;
my $layout = $self->layout;
my $config = $self->config;
my %json = ( data => $self->traces() );
if ( defined $layout ) {
$json{layout}
g ) {
$json{config} = $config;
}
return \%json;
}
sub to_json_text {
my $self = shift;
my $layout = $self->layout;
my $config = $self->config;
my $json = '{ "data"
js} // $params{plotly} // _plotlyjs;
my $tmp_json = Path::Tiny->tempfile( SUFFIX => '.json' );
$tmp_json->spew_raw( $plot->to_json_text );
# For now have to explicitly specif
https://github.com/plotly/orca/issues/101
my @orca_line = ( $ORCA_COMMAND, 'graph', $tmp_json, '--plotlyjs', $plotlyjs, '-d', $file->parent,
'-o', $file->basename, (
d be:
=over
=item Perl data structure of the json expected by plotly.js: L<http://plot.ly/javascript/reference/> (this data would be serialized to JSON)
=item Array ref of objects of type Chart::Pl
otly::Trace::*
=item Anything that could be serialized to JSON with the json expected by plotly.js
=back
=back
=head1 AUTHOR
Pablo RodrĂguez González
=head1 BUGS
Please report any bugs or fea
is encoded by the norm of (u, v, w), and the local radius by the divergence of (u, v, w).
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
y/plotly.js/blob/273292dcb24170f775dbc7ebb285c9b6a80b10f4/test/image/mocks/gl3d_streamtube-simple.json
my $trace = Chart::Plotly::Trace::Streamtube->new(
cmax => 3,
cmin => 0,
y and I want to use it with perl.
=head1 METHODS
=head2 TO_JSON
Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
=head2 type
Trace type.
=head1 ATTRIBUTES
=
ings;
use utf8;
use Exporter 'import';
use vars qw(@EXPORT_OK);
@EXPORT_OK = qw(show_plot);
use JSON;
use Params::Validate qw(:all);
use Text::Template;
use Module::Load;
use Ref::Util;
use HTML::Sh
_process_data {
my $data = shift;
my $json_formatter = JSON->new->allow_blessed(1)->convert_blessed(1);
local *PDL::TO_JSON = sub { $_[0]->unpdl };
if ( Ref::Util::is_blessed
warn 'Cannot load adapter: ' . $adapter_name . '. ' . $@;
}
}
my $data_string = $json_formatter->encode($data);
return $data_string;
}
sub _load_plotly {
my $how_to_load = sh
is using a column-major order, ie. the grid is represented as a vector of column vectors.
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
y and I want to use it with perl.
=head1 METHODS
=head2 TO_JSON
Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
=head2 type
Trace type.
=head1 ATTRIBUTES
=
ng). By default, increasing items are drawn in green whereas decreasing are drawn in red.
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
y and I want to use it with perl.
=head1 METHODS
=head2 TO_JSON
Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
=head2 type
Trace type.
=head1 ATTRIBUTES
=
ssian kernel from `lon` and `lat` coordinates and optional `z` values using a colorscale.
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
t;
use JSON;
use Chart::Plotly::Trace::Densitymapbox;
# Example from https://github.com/plotly/plotly.js/blob/42998576f3ed1dd7f03bfcafd72627a0163bf605/test/image/mocks/mapbox_density0.json
my $t
y and I want to use it with perl.
=head1 METHODS
=head2 TO_JSON
Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
=head2 type
Trace type.
=head1 ATTRIBUTES
=
See also the "funnelarea" trace type for a different approach to visualizing funnel data.
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
y::Plot;
use JSON;
use Chart::Plotly::Trace::Funnel;
# Example from https://github.com/plotly/plotly.js/blob/b93e3a5a83b6561ac6258a59f274b5fc87630c3e/test/image/mocks/funnel_11.json
my $trace1 =
alf Dose', 'Full Dose', 'Double Dose', ], 'y' => [1.4102837, 1.236752, 0.8396031, ], 'visible' => JSON::false, 'orientation' => 'v', });
my $trace4 = Chart::Plotly::Trace::Funnel->new({'y' => [0.86
# VERSION
# ABSTRACT: Parallel categories diagram for multidimensional categorical data.
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
m/plotly/plotly.js/blob/7b751009fc9804272316f0bb539ed0386c0858bd/test/image/mocks/parcats_bundled.json
my $trace = Chart::Plotly::Trace::Parcats->new( bundlecolors => 1,
y and I want to use it with perl.
=head1 METHODS
=head2 TO_JSON
Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
=head2 type
Trace type.
=head1 ATTRIBUTES
=
ce on either the first carpet axis or the carpet axis with a matching `carpet` attribute.
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
y and I want to use it with perl.
=head1 METHODS
=head2 TO_JSON
Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
=head2 type
Trace type.
=head1 ATTRIBUTES
=
ning options are set `xbins` and `ybins` respectively if no aggregation data is provided.
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
y and I want to use it with perl.
=head1 METHODS
=head2 TO_JSON
Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
=head2 type
Trace type.
=head1 ATTRIBUTES
=
ll as spaceframe between iso-min and iso-max values could also be drawn using this trace.
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
8bdcd5ad4d9395626237/test/image/mocks/gl3d_volume_airflow.json
my $volume = Chart::Plotly::Trace::Volume->new(
"flatshading"=>JSON::true,
"lighting"=>{
"facenormalsep
(255,255,0)" ], [ 0.875, "rgb(255,0,0)" ], [ 1.0, "rgb(127,127,127)" ]],
"reversescale"=>JSON::true,
"opacityscale"=>[
[0, 1.0],
[0.2, 0.9],
[0
VERSION
# ABSTRACT: GeoJSON features to be filled are set in `geojson` The data that describes the choropleth value-to-color mapping is set in `locations` and `z`.
sub TO_JSON {
my $self =
"Sets the key in GeoJSON features which is used as id to match the items included in the `locations` array. Support nested property, for example *properties.name*.",
);
has geojson => (
is
ocumentation =>
"Sets the GeoJSON data associated with this trace. It can be set as a valid GeoJSON object or as a URL string. Note that we only accept GeoJSONs of type *FeatureCollection* or *F
# ABSTRACT: This attribute is one of the possible options for the trace choroplethmapbox.
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
use JSON;
use Chart::Plotly::Trace::Choroplethmapbox;
# Example from https://github.com/plotly/plotly.js/blob/cb202a8e47631e20555de382d2bbc7393625519b/test/image/mocks/mapbox_choropleth0.json
my
>new({'locations' => ['NY', 'MA', 'VT', ], 'geojson' => 'https://raw.githubusercontent.com/python-visualization/folium/master/examples/data/us-states.json', 'z' => [10, 20, 30, ], });
my $plot =
by `x` and `y` in this case). The resulting distribution is visualized as a contour plot.
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
y and I want to use it with perl.
=head1 METHODS
=head2 TO_JSON
Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
=head2 type
Trace type.
=head1 ATTRIBUTES
=
to the number of boxes in the traces and the inner length corresponding the sample size.
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
y and I want to use it with perl.
=head1 METHODS
=head2 TO_JSON
Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
=head2 type
Trace type.
=head1 ATTRIBUTES
=
e charts are achieved by setting `marker.size` and/or `marker.color` to numerical arrays.
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
y and I want to use it with perl.
=head1 METHODS
=head2 TO_JSON
Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
=head2 type
Trace type.
=head1 ATTRIBUTES
=
Delaunay triangulation or (3) the Alpha-shape algorithm or (4) the Convex-hull algorithm
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
y and I want to use it with perl.
=head1 METHODS
=head2 TO_JSON
Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
=head2 type
Trace type.
=head1 ATTRIBUTES
=
e x and y coordinates must be provided in `x` and `y` respectively to form data triplets.
sub TO_JSON {
my $self = shift;
my $extra_args = $self->extra_args // {};
my $meta =
y and I want to use it with perl.
=head1 METHODS
=head2 TO_JSON
Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
=head2 type
Trace type.
=head1 ATTRIBUTES
=