File: bars_5.t

package info (click to toggle)
libchart-perl 2.403.9-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,148 kB
  • sloc: perl: 11,360; makefile: 7
file content (46 lines) | stat: -rw-r--r-- 792 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/perl -w

BEGIN { unshift @INC, 'lib', '../lib'}
use strict;
use Chart::Bars;
use File::Temp 0.19;
my $samples = File::Temp->newdir();

print "1..1\n";

my ( @data, @labels, %hash, $g, $hits );

# create an array of labels
for ( 1 .. 49 )
{
    push( @labels, $_ );
}

# create an array of data
for ( 1 .. 49 )
{
    srand( time() / $_ );
    $hits = int( rand(100) + 401 );
    push( @data, $hits );
}

$g = Chart::Bars->new( 700, 300 );
$g->add_dataset(@labels);
$g->add_dataset(@data);

%hash = (
    'legend'       => 'none',
    'precision'    => 0,
    'x_ticks'      => 'vertical',
    'title'        => 'Lottozahlenverteilung',
    'y_label'      => 'Hufigkeit',
    'y_grid_lines' => 'true',

);

$g->set(%hash);
$g->png("$samples/bars_5.png");
print "ok 1\n";

exit(0);