Skip Menu |

This queue is for tickets about the GD-Graph-ohlc CPAN distribution.

Report information
The Basics
Id: 78988
Status: open
Priority: 0/
Queue: GD-Graph-ohlc

People
Owner: jettero [...] cpan.org
Requestors: tfischer [...] bern.swissdatacenters.ch
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: GD-Graph-ohlc
Date: Wed, 15 Aug 2012 23:00:37 +0100
To: bug-GD-Graph-ohlc [...] rt.cpan.org
From: "Fischer, Tom" <tfischer [...] bern.swissdatacenters.ch>
*add colorings for ohlc*
On Wed Aug 15 18:00:52 2012, tfischer@bern.swissdatacenters.ch wrote: Show quoted text
> *add colorings for ohlc*
I'm looking at the internals for GD::Graph::ohlc, which uses GD::Graph::axestype as its base. When a data point comes in, it's really up to that module to select a color for the node. It'd be easy enough to override that behavior and use a different color by copying what candlesticks does when it fills the box rather than leaving it empty. But it's not clear what I'm supposed to do about the legend then. The legend automatically shows what color is for what. It's a dreadful loose end. Mainly GD::Graph expects each independent variable to be exactly one color. I'm not sure there's a solution for this, so I'm just going to ignore it. Another thing though is that it's probably desirable that each data set should have its own color-pair. What kind of interface are you picturing? I've imagined something myself, I want to see if it lines up. -- If riding in an airplane is flying, then riding in a boat is swimming. 116 jumps, 48.6 minutes of freefall, 92.9 freefall miles.
Subject: Re: [rt.cpan.org #78988] GD-Graph-ohlc
Date: Thu, 16 Aug 2012 21:38:28 +0100
To: bug-GD-Graph-ohlc [...] rt.cpan.org
From: "Fischer, Tom" <tfischer [...] bern.swissdatacenters.ch>
My understanding of your comments is that to have two colours for a single series of data represented in OHLC bars could be done, but would mess with the legend colouring. In other words, GD::Graph is capable of graphing multiple data series on the same chart and quite sensibly wishes one colour per data series. In this case, it isn't a bug its a feature. Candlesticks are a different story. If the change of bar (ie whether close <> open) is important one can use candlesticks, if not or for multiple series one can use bars. Unsure of your question re interface. Interface to your modules to do things such as select colour and other features of the graph to be produced, or interface for the whole project? If the former, I'm happy to edit the source to choose the colours etc or pass arguments via the command line (as your example perl script is called by other scripts etc). I am not fussy about having different colours etc and will happily pick a default setting and stick to it. If what interface for the entire application, the goal is not to recreate an entire charting package, although perhaps that is what will be ultimately required. The problem which I am trying to solve is the limited intraday historical data provided by any off the shelf software package. What I have now is a series of scripts which do the following -pull data from the exchange (working automation but still a manual process done weekly - CME has FTP access) -sort into a flat file database by exchange and instrument -parse trade data to 1 minute OHLCV and seperate according to trade date -build various interval chart OHLCV data from the 1 minute data -create a GD::Graph::Candlestick for each OHLC file (no display volume data yet - that is to do) As for the interface, browsing the images in a flat file structure is all I have so far. This is dumped in a web facing folder and one uses the following URL http://host/database/EXCHANGE_INSTRUMENT_YYYYMMDD_INTERVAL.png On Thu, 2012-08-16 at 07:11 -0400, Paul Miller via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=78988 > > > > On Wed Aug 15 18:00:52 2012, tfischer@bern.swissdatacenters.ch wrote:
> > *add colorings for ohlc*
> > I'm looking at the internals for GD::Graph::ohlc, which uses > GD::Graph::axestype as its base. When a data point comes in, it's > really up to that module to select a color for the node. > > It'd be easy enough to override that behavior and use a different color > by copying what candlesticks does when it fills the box rather than > leaving it empty. But it's not clear what I'm supposed to do about the > legend then. The legend automatically shows what color is for what. > > It's a dreadful loose end. Mainly GD::Graph expects each independent > variable to be exactly one color. I'm not sure there's a solution for > this, so I'm just going to ignore it. > > Another thing though is that it's probably desirable that each data set > should have its own color-pair. > > What kind of interface are you picturing? I've imagined something > myself, I want to see if it lines up. > > >
Yeah, the interface... I'm wondering how users should interact with it. I was thinking of something like this. It'll screw up the legend if you're using one, but I'm not sure how bad that is if it's self inflicted. $graph->alt_negative_color({ lgreen => "lred", dgreen => "dred", }); Meaning, if the ohlc or candlestick point is close<open then change lgreen to lred. so you'd basically $graph->set(dclrs => [ qw(lgreen dgreen) ]); then $graph->alt_negative_color({...}); and you'd get the effect you'd want. (I also wrote up an alt_positive_color() ... figuring they're the same thing roughly, why not.) Later one could hack the legend drawing code to draw boxes with two colors in them. Later. Much later. -- If riding in an airplane is flying, then riding in a boat is swimming. 116 jumps, 48.6 minutes of freefall, 92.9 freefall miles.