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

Safe HaskellNone
LanguageHaskell98

Graphics.Rendering.Chart.State

Synopsis

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

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