File: histogram

package info (click to toggle)
libcdk-perl 20130816-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,284 kB
  • ctags: 430
  • sloc: perl: 6,151; sh: 2,997; makefile: 24
file content (53 lines) | stat: -rwxr-xr-x 812 bytes parent folder | download | duplicates (4)
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
47
48
49
50
51
52
53
#!/usr/bin/perl -w
# $Id: histogram,v 1.4 2013/07/14 22:26:47 tom Exp $

#
# Purpose:
#	To demonstrate the Perl5 Cdk Histogram Widget.

use strict;

#
# Initialize Cdk.
#
use Cdk;
Cdk::init();

my $x;

#
# Create the histogram.
#
my $histogram = new Cdk::Histogram(
    'Title'  => "<C>Dum De Dummmm",
    'Height' => 3,
    'Width'  => 0,
    'Orient' => "HORIZONTAL"
);

#
# Set some properties of the histogram.
#
$histogram->set(
    'StatsType'  => "PERCENT",
    'StatsPos'   => "CENTER",
    'FillerChar' => "</R>."
);

# Set the values.
for ( $x = 1 ; $x <= 100 ; $x += 2 ) {

    # Set the values of the histogram.
    $histogram->set(
        'Value' => $x,
        'Low'   => 1,
        'High'  => 100
    );

    # Draw the histogram.
    $histogram->draw();
    sleep(1);
}

# Exit Cdk.
Cdk::end();