~ubuntu-branches/ubuntu/wily/libchart-strip-perl/wily

« back to all changes in this revision

Viewing changes to eg/ex6.pl

  • Committer: Package Import Robot
  • Author(s): Dominic Hargreaves
  • Date: 2012-03-18 21:11:08 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20120318211108-hbfdidex6r4lffa5
Tags: 1.08-1
* Add Vcs-* URLs
* Update to debhelper compat level 8 with minimal rules
* Switch to dpkg-source 3.0 (quilt) format
* Update Standards-Version (no changes)
* New upstream release
* Add missing Copyright statement to debian/copyright

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/local/bin/perl
 
2
# -*- perl -*-
 
3
 
 
4
use Chart::Strip;
 
5
use strict;
 
6
 
 
7
my $img = Chart::Strip->new(
 
8
    title => 'Bee Population',
 
9
    data_label_style => 'box',
 
10
);
 
11
 
 
12
my $data = [];
 
13
for(my $t=0; $t<40; $t++){
 
14
    my $v = (.15,0,0,-.15,1,0,-.3,0,0,0,.15,.30,.15)[$t % 25] || 0;
 
15
 
 
16
    push @$data, {
 
17
        time  => $^T + $t * 1000,
 
18
        value => $v + .1,
 
19
    };
 
20
}
 
21
 
 
22
# smooth graph with shadow
 
23
$img->add_data(
 
24
    $data, {
 
25
        label     => 'Bees',
 
26
        color     => 'FF0000',
 
27
        thickness => 2,
 
28
        style     => 'line',
 
29
        smooth    => 1,
 
30
        shadow    => { dx => 3, dy => 3, dw => 2, color => 'ccdddd' },
 
31
    }
 
32
);
 
33
 
 
34
 
 
35
print $img->png();
 
36