Permalink
Browse files

pass attributes from command-line down to gnuplot library call

Gnuplot.hs: have plotSummaries accept a list of Attributes (gnuplot options) and pass them down to gnuplot library.
zoom-cache-gnuplot.hs: pass [Attribute] down to Data.ZoomCache.Gnuplot.

The [Attribute] value will be obtained by parsing command-line options.
  • Loading branch information...
alang9 committed Oct 19, 2011
1 parent 3a4171c commit a092da2aab6bd7b30739626d8a867aecf6accf67
Showing with 7 additions and 7 deletions.
  1. +2 −2 Data/ZoomCache/Gnuplot.hs
  2. +5 −5 tools/zoom-cache-gnuplot.hs
@@ -32,8 +32,8 @@ singleton = (:[])
instance C Z.TimeStamp where text = singleton . shows . Z.unTS
-plotSummaries :: C a => Int -> [Z.Stream a] -> IO ()
-plotSummaries lvl streams = plotListStyle []
+plotSummaries :: C a => Int -> [Z.Stream a] -> [Attribute] -> IO ()
+plotSummaries lvl streams attrs = plotListStyle attrs
(defaultStyle{plotType = CandleSticks})
candles
where
@@ -50,17 +50,17 @@ main :: IO ()
main = do
args <- getArgs
(opts, remainder) <- parseOpts args
- mapM_ process remainder
+ mapM_ (process opts) remainder
where
- process :: String -> IO ()
- process s = do
+ process :: Options -> String -> IO ()
+ process opts s = do
let (fp, tn, lvl) = either (error "badly formed argument") id $ parseTrack s
cf <- getCacheFile fp
case getTrackType tn cf of
Just ZInt -> do
streams <- getStreams fp tn :: IO [Stream Int]
- plotSummaries lvl streams
+ plotSummaries lvl streams $ gnuplotOpts opts
Just ZDouble -> do
streams <- getStreams fp tn :: IO [Stream Double]
- plotSummaries lvl streams
+ plotSummaries lvl streams $ gnuplotOpts opts
Nothing -> return ()

0 comments on commit a092da2

Please sign in to comment.