Chart-Bokeh
view release on metacpan or search on metacpan
"dist_version" => "0.001",
"license" => "bsd",
"module_name" => "Chart::Bokeh",
"recursive_test_files" => 1,
"requires" => {
"Exporter" => 0,
"HTML::Show" => 0,
"JSON" => 0,
"Module::Load" => 0,
"Params::Validate" => 0,
"Ref::Util" => 0,
"Text::Template" => 0,
"strict" => 0,
"utf8" => 0,
"vars" => 0,
"warnings" => 0
},
"test_requires" => {
"Test::More" => 0,
"Test::Most" => 0
}
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: Chart-Bokeh
requires:
Exporter: '0'
HTML::Show: '0'
JSON: '0'
Module::Load: '0'
Params::Validate: '0'
Ref::Util: '0'
Text::Template: '0'
strict: '0'
utf8: '0'
vars: '0'
warnings: '0'
resources:
bugtracker: https://github.com/pablrod/p5-Chart-Bokeh/issues
homepage: https://github.com/pablrod/p5-Chart-Bokeh
repository: https://github.com/pablrod/p5-Chart-Bokeh.git
version: '0.001'
lib/Chart/Bokeh.pm view on Meta::CPAN
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::Show;
our $VERSION = '0.001'; # VERSION
# ABSTRACT: Generate html/javascript charts from perl data using javascript library BokehJS
sub render_full_html {
my %params = @_;
my $data = $params{'data'};
my $chart_id = 'bokeh_graph';
my $html;
if ( Ref::Util::is_blessed_ref($data) && $data->isa('Chart::Bokeh::Plot') ) {
$html = _render_html_wrap( $data->html( div_id => $chart_id ) );
} else {
$html = _render_html_wrap( _render_cell( _process_data($data), $chart_id ) );
}
return $html;
}
sub _render_html_wrap {
my $body = shift;
my $html_begin = <<'HTML_BEGIN';
lib/Chart/Bokeh.pm view on Meta::CPAN
Bokeh.Plotting.show(p);
';
sub show_plot {
my @data_to_plot = @_;
my $rendered_cells = "";
my $numeric_id = 0;
for my $data (@data_to_plot) {
my $id = 'chart_' . $numeric_id++;
if ( Ref::Util::is_blessed_ref($data) && $data->isa('Chart::Bokeh::Plot') ) {
$rendered_cells .= $data->html( div_id => $id );
} else {
$rendered_cells .= _render_cell( _process_data($data), $id );
}
}
my $plot = _render_html_wrap($rendered_cells);
HTML::Show::show($plot);
}
1;
( run in 0.301 second using v1.01-cache-2.11-cpan-4d50c553e7e )