packages feed

timeplot 0.1.5 → 0.1.6

raw patch · 3 files changed

+30/−18 lines, 3 filesdep ~strptime

Dependency ranges changed: strptime

Files

Graphics/Rendering/Chart/Event.hs view
@@ -60,12 +60,12 @@ renderPlotLegendEvent p r = return ()  -filledRect :: CairoLineStyle -> CairoFillStyle -> Rect -> CRender ()-filledRect ls fs r     = do-  let path = rectPath r-  setFillStyle fs ; fillPath path-  setLineStyle ls ; strokePath path+filledRect :: CairoFillStyle -> Rect -> CRender ()+filledRect fs r = setFillStyle fs >> fillPath (rectPath r) +framedRect :: CairoLineStyle -> Rect -> CRender ()+framedRect ls r = setLineStyle ls >> strokePath (rectPath r)+ barHeight = 15 pulseHeight = 15 @@ -75,21 +75,29 @@       moveTo (Point x0 cy)       lineTo (Point x1 cy)       c $ C.stroke-      mapM_ drawEvent (plot_event_data_ p)+      mapM_ drawEventFill  (plot_event_data_ p)+      mapM_ drawEventFrame (plot_event_data_ p)     where       (Point x0 y0) = pmap (LMin,LMin)       (Point x1 y1) = pmap (LMax,LMax)       (cx,cy) = ((x0+x1)/2, (y0+y1)/2)-      drawEvent (PulseEvent t e) = do+      drawEventFill (PulseEvent t e) = return ()+      drawEventFill (LongEvent t1 t2 e) = do+        let (Point x1 cy)  = pmap (LValue t1, LValue e)+        let (Point x2 cy') = pmap (LValue t2, LValue e) -- Assume cy' == cy (pmap is coordinate-wise)+        filledRect (plot_event_long_fillstyle_ p e) $ Rect+            (Point x1 (cy-barHeight/2)) (Point x2 (cy+barHeight/2))++      drawEventFrame (PulseEvent t e) = do         setLineStyle $ plot_event_pulse_linestyle_ p e         let (Point x y) = pmap (LValue t, LValue e)         moveTo (Point x (y-pulseHeight/2))         lineTo (Point x (y+pulseHeight/2))         c $ C.stroke-      drawEvent (LongEvent t1 t2 e) = do+      drawEventFrame (LongEvent t1 t2 e) = do         let (Point x1 cy)  = pmap (LValue t1, LValue e)         let (Point x2 cy') = pmap (LValue t2, LValue e) -- Assume cy' == cy (pmap is coordinate-wise)-        filledRect (plot_event_long_linestyle_ p e) (plot_event_long_fillstyle_ p e) $ Rect+        framedRect (plot_event_long_linestyle_ p e) $ Rect             (Point x1 (cy-barHeight/2)) (Point x2 (cy+barHeight/2))  plotAllPointsEvent :: PlotEvent t e -> ([t], [e])
Tools/TimePlot.hs view
@@ -13,8 +13,6 @@ import Text.Regex.PCRE import Text.Regex.PCRE.ByteString -import Debug.Trace- import System import System.Exit import System.Console.GetOpt@@ -33,7 +31,6 @@ import Data.Colour import Data.Colour.Names - data Edge = Rise | Fall | Pulse deriving (Eq,Show)  data InEvent = InEdge  Edge@@ -57,7 +54,13 @@ instance Read NominalDiffTime where   readsPrec n s = [(fromIntegral i, s') | (i,s') <- readsPrec n s] -data (Ord t, HasDelta t) => ChartKind t = KindEvent+class (Ord t, HasDelta t, PlotValue t, Show t, Show (Delta t), Read (Delta t)) => TimeAxis t ++instance TimeAxis Double++instance TimeAxis LocalTime++data (TimeAxis t) => ChartKind t = KindEvent                | KindHistogram { binSize :: Delta t }                | KindQuantile  { binSize :: Delta t, quantiles :: [Double] }                | KindBinFreq   { binSize :: Delta t, delims    :: [Double] }@@ -67,7 +70,8 @@                | KindValue                | KindNone -data Conf = forall t . (Ord t, HasDelta t, Read (Delta t), PlotValue t) =>++data Conf = forall t . TimeAxis t =>   Conf {     inFile        :: FilePath,     parseTime     :: B.ByteString -> Maybe (t, B.ByteString),@@ -132,7 +136,7 @@ getArg :: String -> Int -> [String] -> [[String]] getArg name arity args = [take arity as | (t:as) <- tails args, t==name] -readSource :: (B.ByteString -> Maybe (t,B.ByteString)) -> FilePath -> IO [(t, S.ByteString, InEvent)]+readSource :: (Show t) => (B.ByteString -> Maybe (t,B.ByteString)) -> FilePath -> IO [(t, S.ByteString, InEvent)] readSource readTime f = (justs . map parseLine . blines) `fmap` (if f=="-" then B.getContents else B.readFile f)   where     justs xs = [x | Just x <- xs]@@ -160,7 +164,7 @@                   return (t, strict track, InValue v)         _   -> Nothing -makeChart :: forall t . (HasDelta t, PlotValue t) =>+makeChart :: forall t . TimeAxis t =>              (S.ByteString -> ChartKind t) -> [(t, S.ByteString, InEvent)] -> Renderable () makeChart chartKindF []                  = emptyRenderable makeChart chartKindF events@((t0,_,_):_) = renderLayout1sStacked plots
timeplot.cabal view
@@ -1,5 +1,5 @@ Name: timeplot-Version: 0.1.5+Version: 0.1.6 License: BSD3 License-file: LICENSE Copyright: Eugene Kirpichov, 2009@@ -27,7 +27,7 @@   else     Build-Depends: base < 3 -  Build-Depends: Chart >= 0.12, cairo, bytestring, bytestring-lexing, strptime, time, +  Build-Depends: Chart >= 0.12, cairo, bytestring, bytestring-lexing, strptime >= 0.1.4, time,                   containers, colour, data-accessor == 0.2.*, data-accessor-template >= 0.2.1.1 && < 0.3,                   haskell98, regex-pcre   Main-Is: Tools/TimePlot.hs