Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 111 lines (95 sloc) 3.296 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 Chart::Clicker::Renderer::Point;
10 use Geometry::Primitive::Rectangle;
11 use Graphics::Color::RGB;
12
13 my $cc = Chart::Clicker->new(width => 500, height => 50, format => 'pdf');
14
15 my $series = Chart::Clicker::Data::Series->new(
16 keys => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24],
17 values => [ 5.8, 5.0, 4.9, 4.8, 4.5, 4.25, 3.5, 2.9, 2.5, 1.8, .9, .8, .7, 1.1, 1.7, 2.5, 3.0, 4.5, 5.0, 4.9, 4.7, 4.8, 4.2, 4.4],
18 );
19 my $series2 = Chart::Clicker::Data::Series->new(
20 keys => [ 24 ],
21 values => [ 4.4 ]
22 );
23 my $series3 = Chart::Clicker::Data::Series->new(
24 keys => [ 13 ],
25 values => [ .7 ]
26 );
27
28
29 my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series ]);
30
31 $cc->add_to_datasets($ds);
32
33 my $defctx = $cc->get_context('default');
34
35 my $highds = Chart::Clicker::Data::DataSet->new(series => [ $series2 ]);
36 $cc->add_to_datasets($highds);
37
38 my $highctx = Chart::Clicker::Context->new(
39 name => 'high',
40 renderer => Chart::Clicker::Renderer::Point->new(
41 shape => Geometry::Primitive::Circle->new(
42 radius => 5
43 ),
44 shape_brush => Graphics::Primitive::Brush->new(
45 width => 1,
46 color => Graphics::Color::RGB->new(red => .95, green => .94, blue => .92)
47 )
48 ),
49 range_axis => $defctx->range_axis,
50 domain_axis => $defctx->domain_axis
51 );
52 $cc->add_to_contexts($highctx);
53 $highds->context('high');
54 #
55 my $noteds = Chart::Clicker::Data::DataSet->new(series => [ $series3 ]);
56 $cc->add_to_datasets($noteds);
57
58 my $notectx = Chart::Clicker::Context->new(
59 name => 'notable',
60 renderer => Chart::Clicker::Renderer::Point->new(
61 shape => Geometry::Primitive::Circle->new(
62 radius => 5
63 ),
64 shape_brush => Graphics::Primitive::Brush->new(
65 width => 1,
66 color => Graphics::Color::RGB->new(red => .95, green => .94, blue => .92)
67 )
68 ),
69 range_axis => $defctx->range_axis,
70 domain_axis => $defctx->domain_axis
71 );
72 $cc->add_to_contexts($notectx);
73 $noteds->context('notable');
74
75 my $grey = Graphics::Color::RGB->new(
76 red => .36, green => .36, blue => .36, alpha => 1
77 );
78 my $moregrey = Graphics::Color::RGB->new(
79 red => .71, green => .71, blue => .71, alpha => 1
80 );
81 my $orange = Graphics::Color::RGB->new(
82 red => .88, green => .48, blue => .09, alpha => 1
83 );
84
85 # my $mark = Chart::Clicker::Data::Marker->new(value => 2, value2 => 4);
86 # $mark->brush->color(
87 # Graphics::Color::RGB->new(red => 0, green => 0, blue => 0, alpha => .15)
88 # );
89 # $mark->inside_color(
90 # Graphics::Color::RGB->new(red => 0, green => 0, blue => 0, alpha => .15)
91 # );
92 # $defctx->add_marker($mark);
93
94 $cc->background_color(
95 Graphics::Color::RGB->new(red => .95, green => .94, blue => .92)
96 );
97 $cc->color_allocator->colors([ $grey, $orange, $moregrey ]);
98
99 $cc->plot->grid->visible(0);
100 $cc->legend->visible(0);
101 $cc->padding(2);
102 $cc->border->width(0);
103
104 $defctx->range_axis->hidden(1);
105 $defctx->range_axis->fudge_amount(.2);
106 $defctx->domain_axis->hidden(1);
107 $defctx->domain_axis->fudge_amount(.1);
108 $defctx->renderer->brush->width(3);
109
110 $cc->draw;
111 $cc->write('foo.pdf')
Something went wrong with that request. Please try again.