Chart-1.9.5: A library for generating 2D Charts and Plots

Safe Haskell | None
Language | Haskell98

Graphics.Rendering.Chart.State

Synopsis

- plot :: ToPlot p => EC (Layout x y) (p x y) -> EC (Layout x y) ()
- plotLeft :: ToPlot p => EC (LayoutLR x y1 y2) (p x y1) -> EC (LayoutLR x y1 y2) ()
- plotRight :: ToPlot p => EC (LayoutLR x y1 y2) (p x y2) -> EC (LayoutLR x y1 y2) ()
- takeColor :: EC l (AlphaColour Double)
- takeShape :: EC l PointShape
- data CState
- colors :: Lens' CState [AlphaColour Double]
- shapes :: Lens' CState [PointShape]
- type EC l a = StateT l (State CState) a
- execEC :: Default l => EC l a -> l
- liftEC :: Default l1 => EC l1 a -> EC l2 l1
- liftCState :: State CState a -> EC l a

# Documentation

plot :: ToPlot p => EC (Layout x y) (p x y) -> EC (Layout x y) () #

Add a plot to the `Layout` being constructed.

plotLeft :: ToPlot p => EC (LayoutLR x y1 y2) (p x y1) -> EC (LayoutLR x y1 y2) () #

Add a plot against the left axis to the `LayoutLR` being constructed.

plotRight :: ToPlot p => EC (LayoutLR x y1 y2) (p x y2) -> EC (LayoutLR x y1 y2) () #

Add a plot against the right axis tof the `LayoutLR` being constructed.

takeColor :: EC l (AlphaColour Double) #

Pop and return the next color from the state

takeShape :: EC l PointShape #

Pop and return the next shape from the state

data CState #

The state held when monadically constructing a graphical element

#### Instances

Instances details

Default CState # |
Instance details Defined in Graphics.Rendering.Chart.State Methods def :: CState #
(Default a, ToRenderable a) => ToRenderable (EC a b) # |
Instance details Defined in Graphics.Rendering.Chart.State Methods toRenderable :: EC a b -> Renderable () #

colors :: Lens' CState [AlphaColour Double] #

shapes :: Lens' CState [PointShape] #

type EC l a = StateT l (State CState) a #

We use nested State monads to give nice syntax. The outer state is the graphical element being constructed (typically a layout). The inner state contains any additional state reqired. This approach means that lenses and the state monad lens operators can be used directly on the value being constructed.

execEC :: Default l => EC l a -> l #

Run the monadic `EC` computation, and return the graphical element (ie the outer monad' state)

liftEC :: Default l1 => EC l1 a -> EC l2 l1 #

Nest the construction of a graphical element within the construction of another.

liftCState :: State CState a -> EC l a #

Lift a a computation over `CState`