Copyright | (c) Tim Docker 2006, 2014 |
---|---|
License | BSD-style (see chart/COPYRIGHT) |
Safe Haskell | None |
Language | Haskell98 |
This module contains the definition of the Renderable
type, which
is a composable drawing element, along with assorted functions to
them.
- data Renderable a = Renderable {
- minsize :: ChartBackend RectSize
- render :: RectSize -> ChartBackend (PickFn a)
- class ToRenderable a where
- toRenderable :: a -> Renderable ()
- type PickFn a = Point -> Maybe a
- data Rectangle = Rectangle {}
- data RectCornerStyle
- rectangleToRenderable :: Rectangle -> Renderable a
- fillBackground :: FillStyle -> Renderable a -> Renderable a
- addMargins :: (Double, Double, Double, Double) -> Renderable a -> Renderable a
- emptyRenderable :: Renderable a
- embedRenderable :: ChartBackend (Renderable a) -> Renderable a
- label :: FontStyle -> HTextAnchor -> VTextAnchor -> String -> Renderable String
- rlabel :: FontStyle -> HTextAnchor -> VTextAnchor -> Double -> String -> Renderable String
- spacer :: RectSize -> Renderable a
- spacer1 :: Renderable a -> Renderable b
- setPickFn :: PickFn b -> Renderable a -> Renderable b
- mapMaybePickFn :: (a -> Maybe b) -> Renderable a -> Renderable b
- mapPickFn :: (a -> b) -> Renderable a -> Renderable b
- nullPickFn :: PickFn a
- rect_minsize :: Lens' Rectangle RectSize
- rect_fillStyle :: Lens' Rectangle (Maybe FillStyle)
- rect_lineStyle :: Lens' Rectangle (Maybe LineStyle)
- rect_cornerStyle :: Lens' Rectangle RectCornerStyle
Documentation
data Renderable a Source
A Renderable is a record of functions required to layout a graphic element.
Renderable | |
|
class ToRenderable a where Source
A type class abtracting the conversion of a value to a Renderable.
toRenderable :: a -> Renderable () Source
ToRenderable Rectangle | |
ToRenderable PieChart | |
ToRenderable PieLayout | |
ToRenderable SparkLine | |
ToRenderable a => ToRenderable (Grid a) | |
Ord x => ToRenderable (StackedLayouts x) | |
ToRenderable (Legend x y) | |
(Ord x, Ord y) => ToRenderable (Layout x y) | |
(Default a, ToRenderable a) => ToRenderable (EC a b) | |
(Ord x, Ord yl, Ord yr) => ToRenderable (LayoutLR x yl yr) |
type PickFn a = Point -> Maybe a Source
A function that maps a point in device coordinates to some value.
Perhaps it might be generalised from Maybe a to (MonadPlus m ) => m a in the future.
fillBackground :: FillStyle -> Renderable a -> Renderable a Source
Overlay a renderable over a solid background fill.
:: (Double, Double, Double, Double) | The spacing to be added. |
-> Renderable a | The source renderable. |
-> Renderable a |
Add some spacing at the edges of a renderable.
embedRenderable :: ChartBackend (Renderable a) -> Renderable a Source
Helper function for using a renderable, when we generate it in the ChartBackend monad.
label :: FontStyle -> HTextAnchor -> VTextAnchor -> String -> Renderable String Source
Construct a renderable from a text string, aligned with the axes.
rlabel :: FontStyle -> HTextAnchor -> VTextAnchor -> Double -> String -> Renderable String Source
Construct a renderable from a text string, rotated wrt to axes. The angle of rotation is in degrees, measured clockwise from the horizontal.
spacer :: RectSize -> Renderable a Source
Create a blank renderable with a specified minimum size.
spacer1 :: Renderable a -> Renderable b Source
Create a blank renderable with a minimum size the same as some other renderable.
setPickFn :: PickFn b -> Renderable a -> Renderable b Source
Replace the pick function of a renderable with another.
mapMaybePickFn :: (a -> Maybe b) -> Renderable a -> Renderable b Source
Map a function over the result of a renderable's pickfunction, keeping only Just
results.
mapPickFn :: (a -> b) -> Renderable a -> Renderable b Source
Map a function over result of a renderable's pickfunction.
nullPickFn :: PickFn a Source