Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add polar and commit some cleanups.

  • Loading branch information...
commit bfbc1757232ded9fbfd43b0e90bcdfcaf99d1f1f 1 parent 524c0a5
@gphat authored
View
4 area.pl
@@ -10,7 +10,7 @@
use Graphics::Color::RGB;
use Chart::Clicker::Renderer::Area;
-my $cc = Chart::Clicker->new(width => 550, height => 300, format => 'pdf');
+my $cc = Chart::Clicker->new(width => 550, height => 300, format => 'png');
my @hours = qw(
1 2 3 4 5 6 7 8 9 10 11 12
@@ -81,4 +81,4 @@
$cc->legend->font->family('Hoefler Text');
$cc->draw;
-$cc->write('foo.pdf');
+$cc->write('area.png');
View
82 bubble.pl
@@ -1,82 +0,0 @@
-#!/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::Size;
-use Geometry::Primitive::Rectangle;
-use Chart::Clicker::Renderer::Bubble;
-use Graphics::Color::RGB;
-use Geometry::Primitive::Circle;
-
-my $cc = Chart::Clicker->new(width => 500, height => 250, format => 'pdf');
-
-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::Size->new(
- keys => \@hours,
- values => \@bw1,
- sizes => [qw(2 5 9 1 8 9 2 1 3 8 3 1)]
-);
-my $series2 = Chart::Clicker::Data::Series::Size->new(
- keys => \@hours,
- values => \@bw2,
- sizes => [qw(2 5 4 1 8 9 2 1 6 8 8 7)]
-);
-
-my $series3 = Chart::Clicker::Data::Series::Size->new(
- keys => \@hours,
- values => \@bw3,
- sizes => [qw(2 5 3 1 8 9 2 1 1 4 2 5)]
-);
-
-
-$cc->border->width(0);
-$cc->background_color(
- Graphics::Color::RGB->new(red => .95, green => .94, blue => .92)
-);
-my $grey = Graphics::Color::RGB->new(
- red => .36, green => .36, blue => .36, alpha => 1
-);
-my $moregrey = Graphics::Color::RGB->new(
- red => .71, green => .71, blue => .71, alpha => 1
-);
-my $orange = Graphics::Color::RGB->new(
- red => .88, green => .48, blue => .09, alpha => 1
-);
-$cc->color_allocator->colors([ $grey, $moregrey, $orange ]);
-
-$cc->plot->grid->background_color->alpha(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->range_axis->fudge_amount(.05);
-$defctx->domain_axis->fudge_amount(.05);
-$defctx->range_axis->label_font->family('Amaze');
-$defctx->range_axis->tick_font->family('Amaze');
-$defctx->domain_axis->tick_font->family('Amaze');
-$defctx->domain_axis->label_font->family('Amaze');
-$defctx->renderer(Chart::Clicker::Renderer::Bubble->new);
-
-$cc->legend->visible(0);
-
-$cc->draw;
-$cc->write('foo.pdf');
View
50 polararea/polararea.pl
@@ -0,0 +1,50 @@
+#!/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 Chart::Clicker::Renderer::PolarArea;
+use Geometry::Primitive::Rectangle;
+use Graphics::Color::RGB;
+
+my $cc = Chart::Clicker->new(width => 500, height => 400);
+
+my $series1 = Chart::Clicker::Data::Series->new(
+ keys => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
+ values => [ 5, 10, 7, 4, 8, 9, 4, 10, 3, 6 ],
+ name => 'Fails'
+);
+my $series2 = Chart::Clicker::Data::Series->new(
+ keys => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
+ values => [ 5, 10, 16, 9, 4, 4, 11, 9, 3, 1],
+ name => 'Whales'
+);
+my $series3 = Chart::Clicker::Data::Series->new(
+ keys => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
+ values => [ 2, 4, 6, 1, 4, 2, 1, 4, 2, 1],
+ name => 'Tails'
+);
+
+
+my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series1, $series2, $series3 ]);
+
+my $lgreen = Graphics::Color::RGB->new(red => .69, green => .74, blue => .71);
+my $green = Graphics::Color::RGB->new(red => .40, green => .49, blue => .45);
+my $red = Graphics::Color::RGB->new(red => .65, green => .09, blue => .09);
+$cc->color_allocator->colors([ $lgreen, $green, $red ]);
+
+$cc->add_to_datasets($ds);
+
+my $defctx = $cc->get_context('default');
+my $polar = Chart::Clicker::Renderer::PolarArea->new;
+$polar->border_color(Graphics::Color::RGB->new(red => 1, blue => 1, green => 1));
+$polar->brush->width(2);
+$defctx->renderer($polar);
+$defctx->domain_axis->hidden(1);
+$defctx->range_axis->hidden(1);
+$cc->plot->grid->visible(0);
+
+$cc->write_output('foo.png');
View
BIN  polararea/polararea.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
4 simple.pl
@@ -10,7 +10,7 @@
use Graphics::Color::RGB;
use Geometry::Primitive::Circle;
-my $cc = Chart::Clicker->new(width => 500, height => 250, format => 'pdf');
+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
@@ -91,4 +91,4 @@
$cc->legend->font->family('Hoefler Text');
$cc->draw;
-$cc->write('foo.pdf');
+$cc->write('simple.png');
Please sign in to comment.
Something went wrong with that request. Please try again.