#!/usr/bin/perl -w
use strict;
use Chart::Gnuplot;
# Price data in array
my @price = (
[2009, 90, 110, 77, 105],
[2010, 105, 116, 98, 116],
[2011, 116, 128, 108, 123],
[2012, 123, 135, 121, 132],
);
# Chart object
my $chart = Chart::Gnuplot->new(
output => "finance.png",
xrange => [2008, 2013],
bars => 6,
imagesize => "0.45,0.45",
);
# Data set object
my $dataSet = Chart::Gnuplot::DataSet->new(
points => \@price,
style => 'candlesticks',
color => '#77CF77',
fill => {density => 0.5},
width => 5,
);
# Plot the data
$chart->plot2d($dataSet);