Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use simpler api for line example.

  • Loading branch information...
commit 8030070f1ac1436a3ca98378abef8d24597ebfb0 1 parent 74aae23
Cory G Watson authored September 27, 2009

Showing 1 changed file with 9 additions and 28 deletions. Show diff stats Hide diff stats

  1. 37  example/line.pl
37  example/line.pl
@@ -2,19 +2,10 @@
2 2
 use strict;
3 3
 
4 4
 use Chart::Clicker;
5  
-use Chart::Clicker::Context;
6  
-use Chart::Clicker::Data::DataSet;
7  
-use Chart::Clicker::Data::Marker;
8  
-use Chart::Clicker::Data::Series;
9 5
 use Chart::Clicker::Renderer::Line;
10  
-use Geometry::Primitive::Rectangle;
11  
-use Graphics::Color::RGB;
12 6
 
13 7
 my $cc = Chart::Clicker->new(width => 500, height => 250);
14 8
 
15  
-my @hours = qw(
16  
-    1 2 3 4 5 6 7 8 9 10 11 12
17  
-);
18 9
 my @bw1 = qw(
19 10
     5.8 5.0 4.9 4.8 4.5 4.25 3.5 2.9 2.5 1.8 .9 .8
20 11
 );
@@ -25,30 +16,20 @@
25 16
     .3 1.4 1.2 1.5 4.0 3.5 2.0 1.9 2.7 4.2 3.2 1.1
26 17
 );
27 18
 
28  
-my $series1 = Chart::Clicker::Data::Series->new(
29  
-    keys    => \@hours,
30  
-    values  => \@bw1,
31  
-);
32  
-my $series2 = Chart::Clicker::Data::Series->new(
33  
-    keys    => \@hours,
34  
-    values  => \@bw2,
35  
-);
36  
-
37  
-my $series3 = Chart::Clicker::Data::Series->new(
38  
-    keys    => \@hours,
39  
-    values  => \@bw3,
40  
-);
41  
-
42  
-
43  
-my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series1, $series2, $series3 ]);
44  
-
45  
-$cc->add_to_datasets($ds);
  19
+foreach my $d (@bw1) {
  20
+    $cc->add_data('Series 0', $d);
  21
+}
  22
+foreach my $d (@bw2) {
  23
+    $cc->add_data('Series 1', $d);
  24
+}
  25
+foreach my $d (@bw3) {
  26
+    $cc->add_data('Series 2', $d);
  27
+}
46 28
 
47 29
 my $def = $cc->get_context('default');
48 30
 
49 31
 my $ren = Chart::Clicker::Renderer::Line->new;
50 32
 $ren->brush->width(3);
51  
-$def->renderer($area);
52 33
 $def->range_axis->tick_values([qw(1 5 9)]);
53 34
 $def->range_axis->format('%d');
54 35
 $def->domain_axis->tick_values([qw(2 4 6 8 10)]);

0 notes on commit 8030070

Please sign in to comment.
Something went wrong with that request. Please try again.