packages feed

plot-light 0.2.1 → 0.2.2

raw patch · 3 files changed

+23/−6 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Graphics.Rendering.Plot.Light: translateSvg :: Show a => Point a -> Svg -> Svg

Files

plot-light.cabal view
@@ -1,5 +1,5 @@ name:                plot-light-version:             0.2.1+version:             0.2.2 synopsis:            A lightweight plotting library, exporting to SVG description:         A lightweight plotting library, exporting to SVG homepage:            https://github.com/ocramz/plot-light
src/Graphics/Rendering/Plot/Light.hs view
@@ -30,7 +30,7 @@   -- ** Element attributes   LineStroke_(..), StrokeLineJoin_(..), TextAnchor_(..),   -- ** SVG utilities-  svgHeader,+  svgHeader, translateSvg,   -- * Types   Frame(..), Point(..), LabeledPoint(..), labelPoint, Axis(..),   -- * Geometry
src/Graphics/Rendering/Plot/Light/Internal.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE OverloadedStrings #-}-module Graphics.Rendering.Plot.Light.Internal (FigureData(..), Frame(..), mkFrame, mkFrameOrigin, frameToFrame, frameFromPoints, width, height, Point(..), mkPoint, LabeledPoint(..), mkLabeledPoint, labelPoint,  Axis(..), svgHeader, rect, rectCentered, circle, line, tick, ticks, axis, toPlot, text, polyline, filledPolyline, filledBand, candlestick, strokeLineJoin, LineStroke_(..), StrokeLineJoin_(..), TextAnchor_(..), V2(..), Mat2(..), DiagMat2(..), diagMat2, AdditiveGroup(..), VectorSpace(..), Hermitian(..), LinearMap(..), MultiplicativeSemigroup(..), MatrixGroup(..), Eps(..), norm2, normalize2, v2fromEndpoints, v2fromPoint, origin, (-.), pointRange, movePoint, moveLabeledPointV2, moveLabeledPointV2Frames, toSvgFrame, toSvgFrameLP, e1, e2) where+module Graphics.Rendering.Plot.Light.Internal (FigureData(..), Frame(..), mkFrame, mkFrameOrigin, frameToFrame, frameFromPoints, width, height, Point(..), mkPoint, LabeledPoint(..), mkLabeledPoint, labelPoint,  Axis(..), svgHeader, rect, rectCentered, circle, line, tick, ticks, axis, toPlot, text, polyline, filledPolyline, filledBand, candlestick, strokeLineJoin, LineStroke_(..), StrokeLineJoin_(..), TextAnchor_(..), V2(..), Mat2(..), DiagMat2(..), diagMat2, AdditiveGroup(..), VectorSpace(..), Hermitian(..), LinearMap(..), MultiplicativeSemigroup(..), MatrixGroup(..), Eps(..), norm2, normalize2, v2fromEndpoints, v2fromPoint, origin, (-.), pointRange, movePoint, moveLabeledPointV2, moveLabeledPointV2Frames, translateSvg, toSvgFrame, toSvgFrameLP, e1, e2) where  import Data.Monoid ((<>)) import qualified Data.Foldable as F (toList)@@ -63,7 +63,7 @@ -- > > putStrLn $ renderSvg $ rect (Point 100 200) 30 60 2 Nothing (Just C.aquamarine) -- > <rect x="100.0" y="200.0" width="30.0" height="60.0" fill="#7fffd4" stroke="none" stroke-width="2.0" /> rect :: (Show a, RealFrac a) =>-     Point a                 -- ^ Center coordinates           +     Point a                 -- ^ Corner point coordinates              -> a                       -- ^ Width   -> a                       -- ^ Height   -> a                       -- ^ Stroke width@@ -85,12 +85,15 @@   -> Maybe (C.Colour Double) -- ^ Stroke colour   -> Maybe (C.Colour Double) -- ^ Fill colour     -> Svg-rectCentered (Point x0 y0) wid hei sw scol fcol = S.g ! SA.transform (S.translate x0c y0c) $ -  S.rect ! SA.width (vd wid) ! SA.height (vd hei) ! colourFillOpt fcol ! colourStrokeOpt scol ! SA.strokeWidth (vd sw) where+rectCentered p@(Point x0 y0) wid hei sw scol fcol =+  translateSvg (Point x0c y0c) $ rect p wid hei sw scol fcol where    x0c = x0 - (wid / 2)    y0c = y0 - (hei / 2)     +++ -- | Line segment between two `Point`s --  -- > > putStrLn $ renderSvg $ line (Point 0 0) (Point 1 1) 0.1 Continuous C.blueviolet@@ -388,6 +391,20 @@       | slj == Round = "round"       | slj == Bevel = "bevel"       | otherwise = "inherit"++++++++-- | Move a Svg entity to a new position+translateSvg :: Show a => Point a -> Svg -> Svg+translateSvg (Point x y) svg = S.g ! SA.transform (S.translate x y) $ svg++++   -- | Move point to the SVG frame of reference (for which the origing is a the top-left corner of the screen)