Permalink
Browse files

avgPlots: from a list of streams and summary level, retrieve the list…

… of averages
  • Loading branch information...
1 parent 264ce2d commit 0aff580775d26603c042ea254d57235ed309bd55 @alang9 committed Oct 19, 2011
Showing with 11 additions and 0 deletions.
  1. +11 −0 Data/ZoomCache/Gnuplot.hs
View
@@ -14,6 +14,7 @@ module Data.ZoomCache.Gnuplot
( plotSummaries
, getStreams
, candlePlots
+ , avgPlots
) where
import Data.Maybe
@@ -44,6 +45,16 @@ candlePlots streams lvl =
candles = map getSummaryCandleVals $
mapMaybe (maybeSummaryLevel lvl) streams
+avgPlots :: C a => [Z.Stream a] -> Int
+ -> (PlotStyle, [(Z.TimeStamp, Double)])
+avgPlots streams lvl =
+ ( defaultStyle
+ , avgs
+ )
+ where
+ avgs = map getSummaryAvgs $
+ 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 0aff580

Please sign in to comment.