This page shows Perl code snippets using the URI::GoogleChart module to generate chart URLs and the corresponding images that the Google Chart service generate from them.
$u = URI::GoogleChart->new("pie-3d", 250, 100,
data => [60, 40],
label => ["Hello", "World"],
);
$u = URI::GoogleChart->new("pie", 500, 150,
data => [80, 20],
color => ["yellow", "black"],
label => ["Resembes Pack-man", "Does not resemble Pac-man"],
background => "black",
rotate => 35,
margin => [0, 30, 10, 10],
);
$u = URI::GoogleChart->new("pie", 250, 200,
data => [(1) x 12],
rotate => -90,
label => [1 .. 12],
encoding => "s",
background => "transparent",
);
$u = URI::GoogleChart->new("lines", 200, 125,
data => [37,60,60,45,47,74,70,72,],
range_show => "left",
range_round => 1,
);
$u = URI::GoogleChart->new("sparklines", 200, 75,
data => [27,25,60,31,25,39,25,31,26,28,80,28,27,31,27,29,26,35,70,25],
range_round => 1,
);
$u = URI::GoogleChart->new("lxy", 250, 125,
data => [
[10,20,40,80,90,95,99],
[20,30,40,50,60,70,80],
[undef],
[5,25,45,65,85],
],
label => ["blue", "red"],
color => [qw(3072F3 red)],
);
$u = URI::GoogleChart->new("lines", 400, 150,
data => [
{ range => "a", v => [20, 21, 25, 25, 24, 21] },
{ range => "b", v => [1.1, 1.1, 1.3, 1.1, 1.7, 1.9] },
],
range => {
a => { round => 1, show => "left" },
b => { round => 1, show => "right" },
},
color => ["red", "blue"],
label => ["Damage", "Profit"],
chxl => "0:|Jan|Feb|Mar|Apr|May|Jun",
chxt => "x",
);
$u = URI::GoogleChart->new("horizontal-stacked-bars", 200, 150,
data => [
[10,50,60,80,40],
[50,60,100,40,20],
],
color => [qw(3072F3 f00)],
range_show => "bottom",
);
$u = URI::GoogleChart->new("vertical-grouped-bars", 320, 125,
data => [
[10,50,60,80,40],
[50,60,100,40,20],
],
chco => "3072F3,ff0000",
range_show => "left",
);
$u = URI::GoogleChart->new("vertical-stacked-bars", 150, 120,
data => [10, -10, -5, 30, 15, 5],
chbh => "a",
color => "gray",
margin => 5,
range_show => "left",
);
$u = URI::GoogleChart->new("vertical-stacked-bars", 150, 120,
data => [-10, -10, -5, -25, -15, -5],
chbh => "a",
color => "gray",
margin => 5,
range_show => "left",
);
$u = URI::GoogleChart->new("venn", 200, 100,
data => [100, 20, 20, 20, 20, 0, 0],
color => ["red", "lime", "blue"],
label => ["First", "Second", "Third"],
);
$u = URI::GoogleChart->new("gom", 125, 80,
data => 80,
label => 80,
title => "Awsomness",
);
$u = URI::GoogleChart->new("usa", 200, 100);
$u = URI::GoogleChart->new("europe", 300, 150,
color => ["white", "green", "red"],
background => "EAF7FE", # water blue
# nordic populations
chld => "NOSEDKFIIS",
data => [4.5e6, 9e6, 5.3e6, 5.1e6, 307261],
);
Page generated with URI::GoogleChart v1.02