Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Candlestick updates.

  • Loading branch information...
commit 524c0a5528529799898bcb7435aef26a41819cc8 1 parent befde56
@gphat authored
View
34 candlestick/candlestick.pl
@@ -7,7 +7,7 @@
use Chart::Clicker::Renderer::CandleStick;
use Graphics::Color::RGB;
-my $cc = Chart::Clicker->new(width => 500, height => 250, format => 'pdf');
+my $cc = Chart::Clicker->new(width => 500, height => 250, format => 'png');
my $series1 = Chart::Clicker::Data::Series::HighLow->new(
keys => [qw(1 2 3 4 5 6 7 8 9 10)],
@@ -18,51 +18,27 @@
values => [qw(5 4 6 4 8 4 1 1 6 9)]
);
+$cc->title->text('Candlestick');
+$cc->title->padding->bottom(5);
+
# We'll create a dataset with our first two series in it...
my $ds = Chart::Clicker::Data::DataSet->new(
series => [ $series1 ]
);
-my $grey = Graphics::Color::RGB->new(
- red => .36, green => .36, blue => .36, alpha => 1
-);
-my $moregrey = Graphics::Color::RGB->new(
- red => .71, green => .71, blue => .71, alpha => 1
-);
-my $orange = Graphics::Color::RGB->new(
- red => .88, green => .48, blue => .09, alpha => 1
-);
-$cc->color_allocator->colors([ $grey, $moregrey, $orange ]);
-
-$cc->legend->font->family('Hoefler Text');
-
-# Pretty stuff
-$cc->border->width(0);
-
# Add the datasets to the chart
$cc->add_to_datasets($ds);
-$cc->background_color(
- Graphics::Color::RGB->new(red => .95, green => .94, blue => .92)
-);
-$cc->plot->grid->background_color->alpha(0);
-
# Set some labels on the default context
my $defctx = $cc->get_context('default');
$defctx->range_axis->label('Lorem');
$defctx->range_axis->fudge_amount(.2);
-$defctx->range_axis->label_font->family('Hoefler Text');
-$defctx->range_axis->tick_font->family('Gentium');
$defctx->domain_axis->label('Ipsum');
-$defctx->domain_axis->tick_label_angle(0.785398163);
$defctx->domain_axis->fudge_amount(.06);
-$defctx->domain_axis->tick_font->family('Gentium');
-$defctx->domain_axis->label_font->family('Hoefler Text');
# Here's the magic: You can set a renderer for any context. In this case
# we'll change the default to a Bar. Voila!
$defctx->renderer(Chart::Clicker::Renderer::CandleStick->new(bar_padding => 30));
-$cc->draw;
-$cc->write('foo.pdf');
+$cc->write_output('candlestick.png');
View
BIN  candlestick/candlestick.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.