plot 0.1.3.5 → 0.1.4
raw patch · 4 files changed
+21/−16 lines, 4 files
Files
- CHANGES +6/−0
- lib/Graphics/Rendering/Plot/Figure/Plot.hs +4/−2
- lib/Graphics/Rendering/Plot/Render/Plot/Data.hs +10/−13
- plot.cabal +1/−1
CHANGES view
@@ -62,3 +62,9 @@ 0.1.3.5: * fixed .cabal repository line++0.1.4:+ * fix finding min/max of MinMax series+ * fix bar width for Candle/Whisker+ * fix x coordinate of Whisker+ * change bar width for Bar
lib/Graphics/Rendering/Plot/Figure/Plot.hs view
@@ -267,8 +267,10 @@ findMinMax (AbsPoints _ x) (OrdFunction _ f _) = let v = mapVector f x in (minElement v,maxElement v) -- what if errors go beyond plot?-findMinMax _ (OrdPoints _ y _) = let o = getOrdData y- in (minElement o,maxElement o)+findMinMax _ (OrdPoints _ (Plain o) _) = (minElement o,maxElement o)+findMinMax _ (OrdPoints _ (Error o _) _) = (minElement o,maxElement o)+findMinMax _ (OrdPoints _ (MinMax (o,p) _) _) = (Prelude.min (minElement o) (minElement p)+ ,Prelude.max (maxElement o) (maxElement p)) abscMinMax :: Abscissae -> (Double,Double) abscMinMax AbsFunction = defaultXAxisSideLowerRange
lib/Graphics/Rendering/Plot/Render/Plot/Data.hs view
@@ -316,9 +316,10 @@ case s of Nothing -> C.moveTo ((t @> xmin_ix)*xscale) (((fst $ y) @> xmin_ix)*yscale) Just s' -> s'+ _ <- runMaybeT $ mapVectorWithIndexM_ (\i t' -> do when (i >= xmin_ix && i `mod` diff == 0)- (renderMinMaxSample i xmax_ix t' (f xscale yscale) (e xscale yscale) y)+ (renderMinMaxSample i xmax_ix t' (f xscale yscale) (e xscale yscale) y) return ()) t return () @@ -399,8 +400,7 @@ renderBarSample :: Width -> Color -> Color -> Double -> Double -> Double -> Double -> C.Render () renderBarSample bw c bc xscale yscale x y = do setColour bc- let bw' = bw*xscale- C.rectangle ((x*xscale)-bw'/2) 0 bw' (y*yscale)+ C.rectangle ((x*xscale)-bw/2) 0 bw (y*yscale) C.strokePreserve setColour c C.fill@@ -427,33 +427,30 @@ renderCandleSample bw c bc xscale yscale x (yl,yu) = do setColour bc let (yl',yu') = (yl*yscale,yu*yscale)- bw' = bw*xscale- C.rectangle ((x*xscale)-bw'/2) yl' bw' (yu'-yl')+ C.rectangle ((x*xscale)-bw/2) yl' bw (yu'-yl') C.strokePreserve- --liftIO $ putStrLn $ (show yl') ++ " " ++ (show yu') if (yl < yu) then do setColour c else do C.setSourceRGBA 1 1 1 1- C.fill+ C.fill endCandleSample :: Double -> Double -> C.Render () endCandleSample _ _ = return () renderWhiskerSample :: Width -> Color -> Color → Bool -> Double -> Double -> Double -> (Double,Double) -> C.Render ()-renderWhiskerSample bw _ bc whiskers x xscale yscale (yl,yu) = do+renderWhiskerSample bw _ bc whiskers xscale yscale x (yl,yu) = do setColour bc let (x',yl',yu') = (x*xscale,yl*yscale,yu*yscale)- bw' = bw*xscale C.moveTo x' yl' C.lineTo x' yu' if whiskers then do- C.moveTo (x'-bw'/2) yu'- C.lineTo (x'+bw'/2) yu'- C.moveTo (x'-bw'/2) yl'- C.lineTo (x'+bw'/2) yl'+ C.moveTo (x'-bw/2) yu'+ C.lineTo (x'+bw/2) yu'+ C.moveTo (x'-bw/2) yl'+ C.lineTo (x'+bw/2) yl' else return () C.stroke
plot.cabal view
@@ -1,5 +1,5 @@ Name: plot-Version: 0.1.3.5+Version: 0.1.4 License: BSD3 License-file: LICENSE Copyright: (c) A.V.H. McPhail 2010