source: code/Website/perl-ofc-library/test_stackbar.asp@ 7849

Last change on this file since 7849 was 7849, checked in by dennisw, 15 years ago
File size: 2.5 KB
Line 
1<%@ Language="PerlScript"%>
2<%
3
4# For this test you must have an iis webserver with the perlscript dll installed as a language.
5# Also you'll need the open-flash-chart.swf file and the open_flash_chart.pm files together with this one
6#
7
8use strict;
9our ($Server, $Request, $Response);
10use lib $Server->mappath('.');
11use open_flash_chart qw(random_color);
12
13my $g = chart->new();
14my $y_axis = $g->get_axis('y_axis');
15
16my $e = $g->get_element('bar_stack');
17
18my $colors = get_random_colors(5);
19$e->set_values([
20 [{"val"=>rand(20),'colour'=>$colors->[0], 'tip'=>'#val#<br>#total# (bar total)'},{'val'=>rand(40),'colour'=>$colors->[1]}],
21 [{"val"=>rand(20),"colour"=>$colors->[0]},{"val"=>rand(20),"colour"=>$colors->[1]},{"val"=>rand(20),"colour"=>$colors->[2]}],
22 [{"val"=>rand(10),"colour"=>$colors->[0]},{"val"=>rand(20),"colour"=>$colors->[1]},{"val"=>rand(30),"colour"=>$colors->[2]}],
23 [{"val"=>rand(20),"colour"=>$colors->[0]},{"val"=>rand(20),"colour"=>$colors->[1]},{"val"=>rand(20),"colour"=>$colors->[2]}],
24 [{"val"=> rand(5),"colour"=>$colors->[0]},{"val"=>rand(10),"colour"=>$colors->[1]},{"val"=> rand(5),"colour"=>$colors->[2]},{"val"=>rand(20),"colour"=>$colors->[3]},{"val"=>rand(5),"colour"=>$colors->[4]}]
25 ]);
26
27$e->set_tip('#total#<br>(bar total)');
28$y_axis->add_element($e);
29
30
31$colors = get_random_colors(5);
32$e = $g->get_element('bar_stack');
33$e->set_values([
34 [{"val"=>rand(20),"colour"=>$colors->[0]},{"val"=>rand(40),"colour"=>$colors->[1]}],
35 [{"val"=>rand(20),"colour"=>$colors->[0]},{"val"=>rand(20),"colour"=>$colors->[1]},{"val"=>rand(20),"colour"=>$colors->[2]}],
36 [{"val"=>rand(10),"colour"=>$colors->[0]},{"val"=>rand(20),"colour"=>$colors->[1]},{"val"=>rand(30),"colour"=>$colors->[2]}],
37 [{"val"=>rand(20),"colour"=>$colors->[0]},{"val"=>rand(20),"colour"=>$colors->[1]},{"val"=>rand(20),"colour"=>$colors->[2]}],
38 [{"val"=> rand(5),"colour"=>$colors->[0]},{"val"=>rand(10),"colour"=>$colors->[1]},{"val"=> rand(5),"colour"=>$colors->[2]},{"val"=>rand(20),"colour"=>$colors->[3]},{"val"=>rand(5),"colour"=>$colors->[4]}]
39 ]);
40
41$y_axis->add_element($e);
42
43
44%>
45<html>
46 <head>
47 <title>OFC Test Suite - PERL</title>
48 <link type="text/css" rel="stylesheet" media="all" href="style.css"/>
49 </head>
50 <body>
51 <!--#INCLUDE FILE = "list_all_tests.inc"-->
52 <h3>StackBar Test</h3>
53<%
54 $Response->write($g->render_swf({'width'=>600, 'height'=>400}));
55 $Response->write('<p>Should have two stackbar series.</p>');
56%>
57</body>
58</html>
Note: See TracBrowser for help on using the repository browser.