packages feed

timeplot 0.1.4 → 0.1.5

raw patch · 3 files changed

+18/−24 lines, 3 filesdep ~base

Dependency ranges changed: base

Files

Graphics/Rendering/Chart/Event.hs view
@@ -62,10 +62,9 @@  filledRect :: CairoLineStyle -> CairoFillStyle -> Rect -> CRender () filledRect ls fs r     = do-  rectPath r-  c C.closePath-  setFillStyle fs ; c C.fillPreserve-  setLineStyle ls ; c C.stroke+  let path = rectPath r+  setFillStyle fs ; fillPath path+  setLineStyle ls ; strokePath path  barHeight = 15 pulseHeight = 15
Tools/TimePlot.hs view
@@ -65,6 +65,7 @@                | KindFreq      { binSize :: Delta t, style :: PlotBarsStyle }                | KindCount     { binSize :: Delta t, style :: PlotBarsStyle }                | KindValue+               | KindNone  data Conf = forall t . (Ord t, HasDelta t, Read (Delta t), PlotValue t) =>   Conf {@@ -117,6 +118,7 @@         parseKind ["binf",    b,q] = KindBinFreq   {binSize=read b, delims   =read ("["++q++"]")}         parseKind ["binc",    b,q] = KindBinCount  {binSize=read b, delims   =read ("["++q++"]")}         parseKind ["value"       ] = KindValue+        parseKind ["none"        ] = KindNone         parseKind ws               = error ("Unknown diagram kind" ++ unwords ws)          defaultKind = parseKind $ words $ single "default kind" "-dk" "event"@@ -166,7 +168,8 @@     track2events = reverse `fmap` foldl insert M.empty [(s, (t, e)) | (t, s, e) <- events]       where insert m (s, r) = M.alter (Just . maybe [r] (r:)) s m -    plots          = [ plotTrack k es | (k, es) <- M.toList track2events]+    plots          = [ plotTrack k es | (k, es) <- M.toList track2events, +                                        case (chartKindF k) of {KindNone -> False ; _ -> True} ]      timeBounds     = (head times, last times)     times          = sort $ [t | tes <- M.elems track2events, (t,_)<- tes]@@ -181,6 +184,7 @@       KindBinFreq   bs vs -> withAnyOrdinate $ plotTrackBinFreqs  name es vs bs       KindBinCount  bs vs -> withAnyOrdinate $ plotTrackBinCounts name es vs bs       KindValue           -> withAnyOrdinate $ plotTrackValue     name es+      KindNone               -> error "KindNone should not be plotted"      edges  es = [(t,e) | (t,InEdge  e) <- es]     values es = [(t,v) | (t,InValue v) <- es]@@ -189,9 +193,9 @@     lag xs = xs `zip` tail xs      ourPlotBars :: (BarsPlotValue a) => PlotBars t a-    ourPlotBars = plot_bars_spacing ^= BarsFixGap 0 $-                  plot_bars_style   ^= BarsStacked  $-                  plot_bars_alignment ^= BarsLeft   $+    ourPlotBars = plot_bars_spacing ^= BarsFixGap 0 0 $+                  plot_bars_style   ^= BarsStacked    $+                  plot_bars_alignment ^= BarsLeft     $                   defaultPlotBars      plotTrackHistogram name es bs = layoutWithTitle (plotBars plot) name@@ -207,9 +211,7 @@                    plot_bars_item_styles ^= itemStyles  $                    plot_bars_titles      ^= "":map show vs $                    ourPlotBars-            itemStyles = none:cycle [(solidFillStyle (opaque c), Nothing)-                               | c <- [green,blue,yellow,red,orange,-                                       brown,grey,purple,violet,lightblue]]+            itemStyles = none:[(solidFillStyle (opaque c), Nothing) | c <- colors]             vals = byTimeBins ((0:).f vs) bs t0 as             as   = atoms es             vs   = M.keys $ M.fromList $ [(a,()) | (_,a) <- as]@@ -222,26 +224,19 @@                    plot_bars_item_styles ^= quantileStyles $                    plot_bars_titles  ^= quantileTitles $                    ourPlotBars-            quantileStyles = none:[(solidFillStyle (clr i n),-                                    Just $ solidLine 1 (opaque black)) | i <- [0..n+1]]+            quantileStyles = none:(zip (map (solidFillStyle . opaque) colors) [Just $ solidLine 1 (opaque black) | i <- [0..n+1]])             quantileTitles = [""]++[show p1++".."++show p2++"%" | (p1,p2) <- lag percents ]               where percents = map (floor . (*100)) $ [0]++qs++[1]             n = length qs-            (minClr,maxClr) = (green,red)-            clr 0 n = opaque minClr-            clr x n | x==n+1 = opaque maxClr-            clr i n = (maxClr `withOpacity` o) `over` (minClr `withOpacity` (1-o))-              where o = qs!!(i-1)+    +    colors = cycle [green,blue,yellow,red,orange,brown,grey,purple,violet,lightblue]      binTitles vs = [low]++[show v1++".."++show v2 | (v1,v2) <- lag vs]++[high]       where         low = "<"++show (head vs)         high = ">"++show (last vs) -    binColor n i = (maxClr `withOpacity` o) `over` (minClr `withOpacity` (1-o))-      where-        (minClr,maxClr) = (green,red)-        o = fromIntegral i / fromIntegral (n+1)+    binColor n i = opaque (colors !! i)      plotTrackBinFreqs  name es vs bs = plotTrackBars vals (binTitles vs) name (binColor n)       where
timeplot.cabal view
@@ -1,5 +1,5 @@ Name: timeplot-Version: 0.1.4+Version: 0.1.5 License: BSD3 License-file: LICENSE Copyright: Eugene Kirpichov, 2009@@ -23,7 +23,7 @@  executable tplot   if flag(splitbase)-    Build-Depends: base >= 3 && < 4+    Build-Depends: base >= 3 && < 5   else     Build-Depends: base < 3