URI::GoogleChart Examples

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],
    chl => "Hello|World",
);
http://chart.apis.google.com/chart?cht=p3&chs=250x100&chd=t:100,66.7&chl=Hello%7CWorld
$u = URI::GoogleChart->new("pie", 500, 150,
    data => [80, 20],
    color => ["yellow", "black"],
    chl => "Resembes Pack-man|Does not resemble Pac-man",
    chf => "bg,s,000000",
    chp => 0.6,
    margin => [0, 30, 10, 10],
);
http://chart.apis.google.com/chart?cht=p&chs=500x150&chco=FFFF00,000000&chd=t:100,25&chf=bg,s,000000&chl=Resembes+Pack-man%7CDoes+not+resemble+Pac-man&chma=0,30,10,10&chp=0.6
$u = URI::GoogleChart->new("lines", 200, 125,
    data => [40,60,60,45,47,75,70,72,],
    min => 0, max => 100,
);
http://chart.apis.google.com/chart?cht=lc&chs=200x125&chd=t:40,60,60,45,47,75,70,72
$u = URI::GoogleChart->new("sparklines", 200, 125,
    data => [27,25,60,31,25,39,25,31,26,28,80,28,27,31,27,29,26,35,70,25],
    min => 0, max => 100,
);
http://chart.apis.google.com/chart?cht=ls&chs=200x125&chd=t:27,25,60,31,25,39,25,31,26,28.0,80,28.0,27,31,27,29.0,26,35,70,25
$u = URI::GoogleChart->new("lxy", 200, 125,
    data => [
        [10,20,40,80,90,95,99],
	[20,30,40,50,60,70,80],
        [undef],
        [5,25,45,65,85],
    ],
    color => [qw(3072F3 red)],
);
http://chart.apis.google.com/chart?cht=lxy&chs=200x125&chco=3072F3,FF0000&chd=t:5.3,16.0,37.2,79.8,90.4,95.7,100%7C16.0,26.6,37.2,47.9,58.5,69.1,79.8%7C-1%7C0,21.3,42.6,63.8,85.1
$u = URI::GoogleChart->new("horizontal-stacked-bars", 200, 150,
    data => [
        [10,50,60,80,40],
	[50,60,100,40,20],
    ],
    min => 0, max => 200,
    color => [qw(3072F3 f00)],
);
http://chart.apis.google.com/chart?cht=bhs&chs=200x150&chco=3072F3,ff0000&chd=t:5,25,30,40,20%7C25,30,50,20,10
$u = URI::GoogleChart->new("vertical-grouped-bars", 300, 125,
    data => [
        [10,50,60,80,40],
	[50,60,100,40,20],
    ],
    min => 0, max => 100,
    chco => "3072F3,ff0000",
);
http://chart.apis.google.com/chart?cht=bvg&chs=300x125&chco=3072F3,ff0000&chd=t:10,50,60,80,40%7C50,60,100,40,20
$u = URI::GoogleChart->new("gom", 125, 80, data => 80, chl => 80, title => "Awsomness");
http://chart.apis.google.com/chart?cht=gom&chs=125x80&chd=t:80&chl=80&chtt=Awsomness
$u = URI::GoogleChart->new("usa", 200, 100);
http://chart.apis.google.com/chart?cht=t&chtm=usa&chs=200x100
$u = URI::GoogleChart->new("europe", 300, 150,
    color => ["white", "green", "red"],
    chf => "bg,s,EAF7FE", # water
    # nordic populations 
    chld => "NOSEDKFIIS",
    data => [4.5e6, 9e6, 5.3e6, 5.1e6, 307261],
);
http://chart.apis.google.com/chart?cht=t&chtm=europe&chs=300x150&chco=FFFFFF,00FF00,FF0000&chd=t:48.2,100,57.4,55.1,0&chf=bg,s,EAF7FE&chld=NOSEDKFIIS

Page generated with URI::GoogleChart v0.02