Skip to content
Browse files

Add line examples.

  • Loading branch information...
1 parent 8ee7600 commit 52004ab24ac4b0920f399e443156ec54939ae374 @gphat committed Nov 26, 2009
Showing with 131 additions and 0 deletions.
  1. +68 −0 line/line-shapes.pl
  2. BIN line/line-shapes.png
  3. +63 −0 line/line.pl
  4. BIN line/line.png
View
68 line/line-shapes.pl
@@ -0,0 +1,68 @@
+#!/usr/bin/perl
+use strict;
+
+use Chart::Clicker;
+use Chart::Clicker::Context;
+use Chart::Clicker::Data::DataSet;
+use Chart::Clicker::Data::Marker;
+use Chart::Clicker::Data::Series;
+use Geometry::Primitive::Rectangle;
+use Graphics::Color::RGB;
+use Geometry::Primitive::Circle;
+
+my $cc = Chart::Clicker->new(width => 500, height => 250, format => 'png');
+
+my @hours = qw(
+ 1 2 3 4 5 6 7 8 9 10 11 12
+);
+my @bw1 = qw(
+ 5.8 5.0 4.9 4.8 4.5 4.25 3.5 2.9 2.5 1.8 .9 .8
+);
+my @bw2 = qw(
+ .7 1.1 1.7 2.5 3.0 4.5 5.0 4.9 4.7 4.8 4.2 4.4
+);
+my @bw3 = qw(
+ .3 1.4 1.2 1.5 4.0 3.5 2.0 1.9 2.7 4.2 3.2 1.1
+);
+
+my $series1 = Chart::Clicker::Data::Series->new(
+ keys => \@hours,
+ values => \@bw1,
+);
+my $series2 = Chart::Clicker::Data::Series->new(
+ keys => \@hours,
+ values => \@bw2,
+);
+
+my $series3 = Chart::Clicker::Data::Series->new(
+ keys => \@hours,
+ values => \@bw3,
+);
+
+
+$cc->border->width(0);
+
+my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series1, $series2, $series3 ]);
+
+$cc->add_to_datasets($ds);
+
+my $defctx = $cc->get_context('default');
+
+$defctx->range_axis->label('Lorem');
+$defctx->domain_axis->label('Ipsum');
+
+$defctx->renderer->shape(
+ Geometry::Primitive::Circle->new({
+ radius => 5,
+ })
+);
+$defctx->renderer->shape_brush(
+ Graphics::Primitive::Brush->new(
+ width => 2,
+ color => Graphics::Color::RGB->new(red => .90, green => .90, blue => .90)
+ )
+);
+
+$defctx->renderer->brush->width(2);
+
+$cc->write_output('line-shapes.png');
View
BIN line/line-shapes.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
63 line/line.pl
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+use strict;
+
+use Chart::Clicker;
+use Chart::Clicker::Context;
+use Chart::Clicker::Data::DataSet;
+use Chart::Clicker::Data::Marker;
+use Chart::Clicker::Data::Series;
+use Geometry::Primitive::Rectangle;
+use Graphics::Color::RGB;
+use Geometry::Primitive::Circle;
+
+my $cc = Chart::Clicker->new(width => 500, height => 250, format => 'png');
+
+my @hours = qw(
+ 1 2 3 4 5 6 7 8 9 10 11 12
+);
+my @bw1 = qw(
+ 5.8 5.0 4.9 4.8 4.5 4.25 3.5 2.9 2.5 1.8 .9 .8
+);
+my @bw2 = qw(
+ .7 1.1 1.7 2.5 3.0 4.5 5.0 4.9 4.7 4.8 4.2 4.4
+);
+my @bw3 = qw(
+ .3 1.4 1.2 1.5 4.0 3.5 2.0 1.9 2.7 4.2 3.2 1.1
+);
+
+my $series1 = Chart::Clicker::Data::Series->new(
+ keys => \@hours,
+ values => \@bw1,
+);
+my $series2 = Chart::Clicker::Data::Series->new(
+ keys => \@hours,
+ values => \@bw2,
+);
+
+my $series3 = Chart::Clicker::Data::Series->new(
+ keys => \@hours,
+ values => \@bw3,
+);
+
+my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series1, $series2, $series3 ]);
+
+$cc->title->text('Line Chart');
+$cc->title->padding->bottom(5);
+$cc->add_to_datasets($ds);
+
+my $defctx = $cc->get_context('default');
+
+$defctx->range_axis->label('Lorem');
+$defctx->domain_axis->label('Ipsum');
+
+# $defctx->range_axis->label_font->family('Arno Pro');
+# $defctx->range_axis->tick_font->family('Arno Pro');
+# $defctx->domain_axis->tick_font->family('Arno Pro');
+# $defctx->domain_axis->label_font->family('Arno Pro');
+
+$defctx->renderer->brush->width(2);
+
+# $cc->legend->font->size(15);
+# $cc->legend->font->family('Arno Pro');
+
+$cc->write_output('line.png');
View
BIN line/line.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 52004ab

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