|
<html>
<head>
<title>URI::GoogleChart Examples</title>
<style>
body {
margin: 20px 50px;
background-color: #ddd;
max-width: 700px;
font-family: sans-serif;
}
div.eg {
background-color: #eee;
padding: 10px 20px;
border: 1px solid #aaa;
margin: 30px 0;
-webkit-box-shadow: 5px 5px 5px #aaa;
}
.even {
background-color: #edf5ff;
}
pre {
margin: 0px;
font-weight: bold;
}
.uri {
font-size: x-small;
}
img {
border: 1px solid #aaa;
padding: 5px;
margin: 15px 0;
}
</style>
</head>
<body>
<h1>URI::GoogleChart Examples</h1>
<p> This page shows Perl code snippets using the <a
to generate chart URLs and the corresponding images that the <a
from them.
</p>
<div class="eg">
<pre class="src">$u = URI::GoogleChart->new("pie-3d", 250, 100,
data => [60, 40],
label => ["Hello", "World"],
);
</pre>
</div>
<div class="eg">
<pre class="src">$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],
);
</pre>
</div>
<div class="eg">
<pre class="src">$u = URI::GoogleChart->new("pie", 250, 200,
data => [(1) x 12],
rotate => -90,
label => [1 .. 12],
encoding => "s",
background => "transparent",
);
</pre>
</div>
<div class="eg">
<pre class="src">$u = URI::GoogleChart->new("lines", 200, 125,
data => [37,60,60,45,47,74,70,72,],
range_show => "left",
range_round => 1,
);
</pre>
</div>
<div class="eg">
<pre class="src">$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,
);
</pre>
</div>
<div class="eg">
<pre class="src">$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)],
);
</pre>
</div>
<div class="eg">
<pre class="src">$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",
);
</pre>
<div><img src='http://chart.apis.google.com/chart?cht=bhs&chs=200x150&chco=3072F3,ff0000&chxr=0,0,1.6e%2B02&chxt=x&chd=t:6.2,31.2,37.5,50,25%7C31.2,37.5,62.5,25,12.5'></div> <span class="uri">http://chart.apis.google.com/chart?cht=bhs&chs=200x150&chco=3072F3,ff0000&chxr=0,0,1.6e%2B02&chxt=x&chd=t:6.2,31.2,37.5,50,25%7C31.2,37.5,62.5,25,12.5</span> </div>
<div class="eg">
<pre class="src">$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",
);
</pre>
<div><img src='http://chart.apis.google.com/chart?cht=bvg&chs=320x125&chco=3072F3,ff0000&chxr=0,0,1e%2B02&chxt=y&chd=t:10,50,60,80,40%7C50,60,100,40,20'></div> <span class="uri">http://chart.apis.google.com/chart?cht=bvg&chs=320x125&chco=3072F3,ff0000&chxr=0,0,1e%2B02&chxt=y&chd=t:10,50,60,80,40%7C50,60,100,40,20</span> </div>
<div class="eg">
<pre class="src">$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",
);
</pre>
<div><img src='http://chart.apis.google.com/chart?cht=bvs&chs=150x120&chbh=a&chco=808080&chma=5,5,5,5&chp=0.25&chxr=0,-10,30&chxt=y&chd=t:50,0,12.5,100,62.5,37.5'></div> <span class="uri">http://chart.apis.google.com/chart?cht=bvs&chs=150x120&chbh=a&chco=808080&chma=5,5,5,5&chp=0.25&chxr=0,-10,30&chxt=y&chd=t:50,0,12.5,100,62.5,37.5</span> </div>
<div class="eg">
<pre class="src">$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",
);
</pre>
<div><img src='http://chart.apis.google.com/chart?cht=bvs&chs=150x120&chbh=a&chco=808080&chma=5,5,5,5&chp=1.00&chxr=0,-25,0&chxt=y&chd=t:60,60,80,0,40,80'></div> <span class="uri">http://chart.apis.google.com/chart?cht=bvs&chs=150x120&chbh=a&chco=808080&chma=5,5,5,5&chp=1.00&chxr=0,-25,0&chxt=y&chd=t:60,60,80,0,40,80</span> </div>
<div class="eg">
<pre class="src">$u = URI::GoogleChart->new("venn", 200, 100,
data => [100, 20, 20, 20, 20, 0, 0],
color => ["red", "lime", "blue"],
label => ["First", "Second", "Third"],
);
</pre>
</div>
<div class="eg">
<pre class="src">$u = URI::GoogleChart->new("gom", 125, 80,
data => 80,
label => 80,
title => "Awsomness",
);
</pre>
</div>
<div class="eg">
<pre class="src">$u = URI::GoogleChart->new("usa", 200, 100);
</pre>
</div>
<div class="eg">
<pre class="src">$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],
);
</pre>
</div>
<p style="font-size: small;">Page generated with URI::GoogleChart v1.01</p>
</body>
</html>
|