Permalink
Browse files

candlePlots: return a tuple which specifies how to plot (candlesticks…

…) and what to plot (list of tuples)
  • Loading branch information...
1 parent d1f12de commit 1dcc1f5a23cfc69d6c6cad2aa2c8b5e42afd9cfc @alang9 committed Oct 19, 2011
Showing with 12 additions and 0 deletions.
  1. +12 −0 Data/ZoomCache/Gnuplot.hs
View
@@ -13,6 +13,7 @@
module Data.ZoomCache.Gnuplot
( plotSummaries
, getStreams
+ , candlePlots
) where
import Data.Maybe
@@ -32,6 +33,17 @@ singleton = (:[])
instance C Z.TimeStamp where text = singleton . shows . Z.unTS
+
+candlePlots :: C a => [Z.Stream a] -> Int
+ -> (PlotStyle, [(Z.TimeStamp, (a, a, a, a))])
+candlePlots streams lvl =
+ ( defaultStyle{plotType = CandleSticks}
+ , candles
+ )
+ where
+ candles = map getSummaryCandleVals $
+ mapMaybe (maybeSummaryLevel lvl) streams
+
plotSummaries :: C a => Int -> [Z.Stream a] -> [Attribute] -> IO ()
plotSummaries lvl streams attrs = plotListStyle attrs
(defaultStyle{plotType = CandleSticks})

0 comments on commit 1dcc1f5

Please sign in to comment.