Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

candlePlots renamed and split into candlePlot and candlePlotData

candlePlot renamed from candlePlots, because it only really yields one plot. Also split into 2 functions so that the library doesn't have to be aware of the concrete types and stay parametric.
  • Loading branch information...
commit c2929c71bd7a4db3bebdcf52f9da1e2d78c0bfaa 1 parent 8967f14
@alang9 authored
Showing with 23 additions and 23 deletions.
  1. +23 −23 Data/ZoomCache/Gnuplot.hs
View
46 Data/ZoomCache/Gnuplot.hs
@@ -32,36 +32,36 @@ import Graphics.Gnuplot.Simple
singleton :: a -> [a]
singleton = (:[])
-instance C Z.TimeStamp where text = singleton . shows . Z.unTS
+instance Tuple.C Z.TimeStamp where
+ text = singleton . shows . Z.unTS
+instance Atom.C Z.TimeStamp where
-
-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 $
+candlePlotData :: [Z.Stream a] -> Int
+ -> [(Z.TimeStamp, (a, a, a, a))]
+candlePlotData streams lvl =
+ map getSummaryCandleVals $
mapMaybe (maybeSummaryLevel lvl) streams
-avgPlots :: C a => [Z.Stream a] -> Int
- -> (PlotStyle, [(Z.TimeStamp, Double)])
-avgPlots streams lvl =
- ( defaultStyle
- , avgs
- )
+candlePlot :: (Tuple.C a, Atom.C a) => [(Z.TimeStamp, (a, a, a, a))]
+ -> Plot.T Z.TimeStamp a
+candlePlot data_ =
+ Plot.list Graph.candleSticks data_
+
+avgPlot :: Atom.C a => [Z.Stream a] -> Int
+ -> Plot.T Z.TimeStamp Double
+avgPlot streams lvl =
+ Plot.list Graph.lines 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})
- candles
- where
- candles = map getSummaryCandleVals $
- mapMaybe (maybeSummaryLevel lvl) streams
+-- plotSummaries :: Atom.C a => Int -> [Z.Stream a] -> [Attribute] -> IO ()
+-- plotSummaries lvl streams attrs = plotListStyle attrs
+-- (defaultStyle{plotType = CandleSticks})
+-- candles
+-- where
+-- candles = map getSummaryCandleVals $
+-- mapMaybe (maybeSummaryLevel lvl) streams
getStreams :: Z.ZReadable a => FilePath -> Z.TrackNo -> IO [Z.Stream a]
getStreams fp tn =
Please sign in to comment.
Something went wrong with that request. Please try again.