Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…) and what to plot (list of tuples)
  • Loading branch information...
commit 1dcc1f5a23cfc69d6c6cad2aa2c8b5e42afd9cfc 1 parent d1f12de
@alang9 authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 Data/ZoomCache/Gnuplot.hs
View
12 Data/ZoomCache/Gnuplot.hs
@@ -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})
Please sign in to comment.
Something went wrong with that request. Please try again.