DBIx::Chart "real" Candlestick
am 29.07.2007 20:51:56 von tomtailorHello
Do anybody know how to draw a real candlesick bar chart with open,
high, low, close instead of high and low?
A "real" candlestick = http://tinyurl.com/3yayg7
DBD::Chart candlestick = http://www.presicient.com/dbdchart/dbdchart_frame.html#candl estick
Maybe I can combine 2 kind of charts to make it look like a real
candlestick?
Thanks for Help!
Christian Maier
PS testable sample code snipped (looks a bit wired yet cause of open,
high, low and close):
#!/usr/bin/perl
use DBI;
$dbh = DBI->connect('dbi:Chart:', undef, undef);
# multrange 3D barchart with imagemap
#
my @date = ("2007-01-01", "2007-01-02");
my @open = (10, 13);
my @high = (12, 13);
my @low = (9, 10);
my @close= (11, 12);
$dbh->do('CREATE TABLE candletest (datum date, o integer, h integer, l
integer, c integer)');
$sth = $dbh->prepare('INSERT INTO candletest VALUES(?, ?, ?, ?, ?)');
$sth->execute($date[0], $open[0], $high[0], $low[0], $close[0]);
$sth->execute($date[1], $open[1], $high[1], $low[1], $close[1]);
$sth = $dbh->prepare("SELECT candlestick from candletest
WHERE WIDTH=400 AND HEIGHT=400 AND
title = 'Sample THREE_D Bar Chart' AND
signature = 'Copyright(C) 2001, Presicient Corp.' AND
X_AXIS = 'datum' AND
Y_AXIS = 'high' AND
SHAPE='fillsquare' AND
SHOWGRID = 1 AND
COLORS=(red, blue) AND
SHOWVALUES=1 AND
MAPNAME = 'candlesample' AND
mapURL = 'http://www.presicient.com/samplemap.pl'"
);
$sth->execute;
$row = $sth->fetchrow_arrayref;
open(BAR, '>samp3dbar5.png');
binmode BAR;
print BAR $$row[0];
close BAR;
$dbh->do('DROP table candletest');
print "Candlestick Chart OK\n";