File: split_2.t

package info (click to toggle)
libchart-perl 2.4.1-4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,804 kB
  • ctags: 370
  • sloc: perl: 9,120; makefile: 532
file content (38 lines) | stat: -rwxr-xr-x 957 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/perl -w


use Chart::Split;
print "1..1\n";

$g = Chart::Split->new(500,500);
$last =0;

# create arrays of data
for (1..4000) {
  srand(time()/$_*50);   #intialize the random number generator
  $y1 = (rand(10))  ;    #generate the number
  push (@x, $_);        #add the x-values
  push (@y1, $y1);       #add the random number
  push (@y2, abs($y1-$last));     #add the difference to the last number
  $last = $y1;
}

$g->add_dataset(@x);
$g->add_dataset(@y1);
$g->add_dataset(@y2);

%options = (
            'start' => 0,
            'interval' => 400,
            'brush_size' => 1,
            'interval_ticks' => 0,
            'title' => "Random Numbers Test",
            'legend_labels' => ['random numbers', 'difference'],
            'x_label' => "4000 Random Numbers",
            'legend' => 'bottom',
            );
$g->set(%options);
$g->png("samples/split_2.png");
print "ok 1\n";

exit (0);