Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 85 lines (70 sloc) 2.31 kB
f78bc6a @gphat Initial import.
authored
1 #!/usr/bin/perl
2 use strict;
3
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 use Geometry::Primitive::Rectangle;
10 use Graphics::Color::RGB;
11 use Chart::Clicker::Renderer::Area;
12
bfbc175 @gphat Add polar and commit some cleanups.
authored
13 my $cc = Chart::Clicker->new(width => 550, height => 300, format => 'png');
f78bc6a @gphat Initial import.
authored
14
15 my @hours = qw(
16 1 2 3 4 5 6 7 8 9 10 11 12
17 );
18 my @bw1 = qw(
19 5.8 5.0 4.9 4.8 4.5 4.25 3.5 2.9 2.5 1.8 .9 .8
20 );
21 my @bw2 = qw(
22 .7 1.1 1.7 2.5 3.0 4.5 5.0 4.9 4.7 4.8 4.2 4.4
23 );
24 my @bw3 = qw(
25 .3 1.4 1.2 1.5 4.0 3.5 2.0 1.9 2.7 4.2 3.2 1.1
26 );
27
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 $cc->border->width(0);
44 $cc->background_color(
45 Graphics::Color::RGB->new(red => .95, green => .94, blue => .92)
46 );
47 my $grey = Graphics::Color::RGB->new(
48 red => .36, green => .36, blue => .36, alpha => 1
49 );
50 my $moregrey = Graphics::Color::RGB->new(
51 red => .71, green => .71, blue => .71, alpha => 1
52 );
53 my $orange = Graphics::Color::RGB->new(
54 red => .88, green => .48, blue => .09, alpha => 1
55 );
56 $cc->color_allocator->colors([ $grey, $moregrey, $orange ]);
57
58 $cc->plot->grid->background_color->alpha(0);
59 my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series1, $series2, $series3 ]);
60
61 $cc->add_to_datasets($ds);
62
63 my $defctx = $cc->get_context('default');
64
65 $cc->legend->visible(0);
66 # $defctx->range_axis->label('Lorem');
67 # $defctx->domain_axis->label('Ipsum');
68 $defctx->range_axis->brush->width(0);
69 $defctx->domain_axis->brush->width(0);
70 $defctx->range_axis->show_ticks(0);
71 $defctx->domain_axis->show_ticks(0);
72
73 $defctx->domain_axis->tick_label_angle(0.785398163);
74 $defctx->range_axis->label_font->family('Hoefler Text');
75 $defctx->range_axis->tick_font->family('Hoefler Text');
76 $defctx->domain_axis->tick_font->family('Hoefler Text');
77 $defctx->domain_axis->label_font->family('Hoefler Text');
78 $defctx->renderer(Chart::Clicker::Renderer::Area->new(opacity => .75));
79 $defctx->renderer->brush->width(2);
80
81 $cc->legend->font->family('Hoefler Text');
82
83 $cc->draw;
bfbc175 @gphat Add polar and commit some cleanups.
authored
84 $cc->write('area.png');
Something went wrong with that request. Please try again.