Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 68 lines (54 sloc) 1.541 kB
e96afec @gphat Brushed work
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 Geometry::Primitive::Circle;
12
13 my $cc = Chart::Clicker->new(width => 500, height => 250, format => 'png');
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 my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series1, $series2, $series3 ]);
44
45 $cc->title->text('Line + Shapes (Brushed)');
46 $cc->add_to_datasets($ds);
47
48 my $defctx = $cc->get_context('default');
49
50 $defctx->range_axis->label('Lorem');
51 $defctx->domain_axis->label('Ipsum');
52
53 $defctx->renderer->shape(
54 Geometry::Primitive::Circle->new({
55 radius => 5,
56 })
57 );
58 $defctx->renderer->shape_brush(
59 Graphics::Primitive::Brush->new(
60 width => 2,
61 color => Graphics::Color::RGB->new(red => 1, green => 1, blue => 1)
62 )
63 );
64
65 $defctx->renderer->brush->width(2);
66
67 $cc->write_output('line-shapes-brushed.png');
Something went wrong with that request. Please try again.