Permalink
Browse files

DAte axis example

  • Loading branch information...
1 parent f39fe31 commit 603973071a5f65f467236ee79426580b9d114b47 Cory Watson committed Nov 25, 2009
Showing with 43 additions and 0 deletions.
  1. +1 −0 Changes
  2. +42 −0 example/date-axis.pl
View
@@ -2,6 +2,7 @@ Revision history for Perl extension Chart::Clicker.
2.42
- Document the ->draw,->data method for getting back a scalar
+ - Add date-axis.pl example
2.41
- Add title/title_position
View
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+use strict;
+
+use Chart::Clicker;
+use Chart::Clicker::Axis::DateTime;
+use Chart::Clicker::Data::DataSet;
+use Chart::Clicker::Data::Series;
+
+my $cc = Chart::Clicker->new(width => 500, height => 400);
+
+my $series1 = Chart::Clicker::Data::Series->new(
+ values => [qw(1 2 3 4 5 6 7 8 9 10 11 12)],
+ keys => [qw(
+ 1257069600
+ 1257156000
+ 1257242400
+ 1257328800
+ 1257415200
+ 1257501600
+ 1257588000
+ 1257674400
+ 1257760800
+ 1257847200
+ 1257933600
+ 1258020000
+ )]
+);
+
+my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series1 ]);
+
+$cc->add_to_datasets($ds);
+
+my $def = $cc->get_context('default');
+
+my $dtaxis = Chart::Clicker::Axis::DateTime->new(
+ format => '%m/%d',
+ position => 'bottom',
+ orientation => 'horizontal'
+);
+$def->domain_axis($dtaxis);
+
+$cc->write_output('foo.png');

0 comments on commit 6039730

Please sign in to comment.