Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 79 lines (62 sloc) 2.357 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
12 my $cc = Chart::Clicker->new(width => 500, height => 250, format => 'pdf');
13
14 my $series1 = Chart::Clicker::Data::Series->new(
15 keys => [qw(1 2 3 4 5 6 7 8 9 10 11 12)],
16 values => [qw(5.8 5.0 4.9 4.8 4.5 4.25 3.5 2.9 2.5 1.8 .9 .8)]
17 );
18
19 my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series1 ]);
20
21 $cc->add_to_datasets($ds);
22 $cc->border->width(0);
23
24 $cc->background_color(
25 Graphics::Color::RGB->new(red => .95, green => .94, blue => .92)
26 );
27 $cc->plot->grid->background_color->alpha(0);
28
29 my $orange = Graphics::Color::RGB->new(
30 red => .88, green => .48, blue => .09, alpha => 1
31 );
32 $cc->color_allocator->colors([ $orange ]);
33
34 my $domain_range_marker = Chart::Clicker::Data::Marker->new(key => 4, key2 => 6);
35 $domain_range_marker->inside_color(
36 Graphics::Color::RGB->new(
37 red => .88, green => .48, blue => .09, alpha => .35
38 )
39 );
40
41 my $domain_marker = Chart::Clicker::Data::Marker->new(key => 7);
42 $domain_marker->color($orange);
43
44 my $range_range_marker = Chart::Clicker::Data::Marker->new(value => 4, value2 => 5);
45 $range_range_marker->inside_color(
46 Graphics::Color::RGB->new(red => 0, green => 0, blue => 0, alpha => .12)
47 );
48
49 my $range_marker = Chart::Clicker::Data::Marker->new(value => 2);
50 $range_marker->color(
51 Graphics::Color::RGB->new(
52 red => .88, green => .48, blue => .09, alpha => .5
53 )
54 );
55 $range_marker->brush->width(5);
56 $range_marker->brush->dash_pattern([qw(15 15)]);
57
58 my $defctx = $cc->get_context('default');
59 $cc->plot->grid->visible(0);
60
61 $cc->legend->visible(0);
62 $defctx->range_axis->label('Lorem');
63 $defctx->range_axis->show_ticks(0);
64 $defctx->domain_axis->label('Ipsum');
65 # $defctx->domain_axis->tick_label_angle(0.785398163);
66 $defctx->range_axis->label_font->family('Hoefler Text');
67 $defctx->range_axis->tick_font->family('Gentium');
68 $defctx->domain_axis->tick_font->family('Gentium');
69 $defctx->domain_axis->label_font->family('Hoefler Text');
70
71
72 $defctx->add_marker($domain_range_marker);
73 $defctx->add_marker($range_range_marker);
74 $defctx->add_marker($range_marker);
75 $defctx->add_marker($domain_marker);
76
77 $cc->draw;
78 $cc->write('foo.pdf');
Something went wrong with that request. Please try again.