Copyright | (c) Tim Docker 2006 2014 |
---|---|
License | BSD-style (see chart/COPYRIGHT) |
Safe Haskell | None |
Language | Haskell98 |
Graphics.Rendering.Chart.Layout
Description
This module glues together axes and plots to actually create a renderable for a chart.
Note that Template haskell is used to derive accessor functions
(see Lens
) for each field of the following data types:
Synopsis
- data Layout x y = Layout {
- _layout_background :: FillStyle
- _layout_plot_background :: Maybe FillStyle
- _layout_title :: String
- _layout_title_style :: FontStyle
- _layout_x_axis :: LayoutAxis x
- _layout_top_axis_visibility :: AxisVisibility
- _layout_bottom_axis_visibility :: AxisVisibility
- _layout_y_axis :: LayoutAxis y
- _layout_left_axis_visibility :: AxisVisibility
- _layout_right_axis_visibility :: AxisVisibility
- _layout_plots :: [Plot x y]
- _layout_legend :: Maybe LegendStyle
- _layout_margin :: Double
- _layout_grid_last :: Bool
- data LayoutLR x y1 y2 = LayoutLR {
- _layoutlr_background :: FillStyle
- _layoutlr_plot_background :: Maybe FillStyle
- _layoutlr_title :: String
- _layoutlr_title_style :: FontStyle
- _layoutlr_x_axis :: LayoutAxis x
- _layoutlr_top_axis_visibility :: AxisVisibility
- _layoutlr_bottom_axis_visibility :: AxisVisibility
- _layoutlr_left_axis :: LayoutAxis y1
- _layoutlr_left_axis_visibility :: AxisVisibility
- _layoutlr_right_axis :: LayoutAxis y2
- _layoutlr_right_axis_visibility :: AxisVisibility
- _layoutlr_plots :: [Either (Plot x y1) (Plot x y2)]
- _layoutlr_legend :: Maybe LegendStyle
- _layoutlr_margin :: Double
- _layoutlr_grid_last :: Bool
- data LayoutAxis x = LayoutAxis {
- _laxis_title_style :: FontStyle
- _laxis_title :: String
- _laxis_style :: AxisStyle
- _laxis_generate :: AxisFn x
- _laxis_override :: AxisData x -> AxisData x
- _laxis_reverse :: Bool
- data LayoutPick x y1 y2
- = LayoutPick_Legend String
- | LayoutPick_Title String
- | LayoutPick_XTopAxisTitle String
- | LayoutPick_XBottomAxisTitle String
- | LayoutPick_YLeftAxisTitle String
- | LayoutPick_YRightAxisTitle String
- | LayoutPick_PlotArea x y1 y2
- | LayoutPick_XTopAxis x
- | LayoutPick_XBottomAxis x
- | LayoutPick_YLeftAxis y1
- | LayoutPick_YRightAxis y2
- data StackedLayouts x = StackedLayouts {}
- data StackedLayout x
- = Ord y => StackedLayout (Layout x y)
- | (Ord yl, Ord yr) => StackedLayoutLR (LayoutLR x yl yr)
- type MAxisFn t = [t] -> Maybe (AxisData t)
- layoutToRenderable :: (Ord x, Ord y) => Layout x y -> Renderable (LayoutPick x y y)
- layoutToGrid :: (Ord x, Ord y) => Layout x y -> Grid (Renderable (LayoutPick x y y))
- layoutLRToRenderable :: (Ord x, Ord yl, Ord yr) => LayoutLR x yl yr -> Renderable (LayoutPick x yl yr)
- layoutLRToGrid :: (Ord x, Ord yl, Ord yr) => LayoutLR x yl yr -> Grid (Renderable (LayoutPick x yl yr))
- renderStackedLayouts :: Ord x => StackedLayouts x -> Renderable ()
- laxis_title_style :: forall x f. Functor f => (FontStyle -> f FontStyle) -> LayoutAxis x -> f (LayoutAxis x)
- laxis_title :: forall x f. Functor f => (String -> f String) -> LayoutAxis x -> f (LayoutAxis x)
- laxis_style :: forall x f. Functor f => (AxisStyle -> f AxisStyle) -> LayoutAxis x -> f (LayoutAxis x)
- laxis_generate :: forall x f. Functor f => (AxisFn x -> f (AxisFn x)) -> LayoutAxis x -> f (LayoutAxis x)
- laxis_override :: forall x f. Functor f => ((AxisData x -> AxisData x) -> f (AxisData x -> AxisData x)) -> LayoutAxis x -> f (LayoutAxis x)
- laxis_reverse :: forall x f. Functor f => (Bool -> f Bool) -> LayoutAxis x -> f (LayoutAxis x)
- layout_background :: forall x y f. Functor f => (FillStyle -> f FillStyle) -> Layout x y -> f (Layout x y)
- layout_plot_background :: forall x y f. Functor f => (Maybe FillStyle -> f (Maybe FillStyle)) -> Layout x y -> f (Layout x y)
- layout_title :: forall x y f. Functor f => (String -> f String) -> Layout x y -> f (Layout x y)
- layout_title_style :: forall x y f. Functor f => (FontStyle -> f FontStyle) -> Layout x y -> f (Layout x y)
- layout_x_axis :: forall x y f. Functor f => (LayoutAxis x -> f (LayoutAxis x)) -> Layout x y -> f (Layout x y)
- layout_top_axis_visibility :: forall x y f. Functor f => (AxisVisibility -> f AxisVisibility) -> Layout x y -> f (Layout x y)
- layout_bottom_axis_visibility :: forall x y f. Functor f => (AxisVisibility -> f AxisVisibility) -> Layout x y -> f (Layout x y)
- layout_y_axis :: forall x y f. Functor f => (LayoutAxis y -> f (LayoutAxis y)) -> Layout x y -> f (Layout x y)
- layout_left_axis_visibility :: forall x y f. Functor f => (AxisVisibility -> f AxisVisibility) -> Layout x y -> f (Layout x y)
- layout_right_axis_visibility :: forall x y f. Functor f => (AxisVisibility -> f AxisVisibility) -> Layout x y -> f (Layout x y)
- layout_margin :: forall x y f. Functor f => (Double -> f Double) -> Layout x y -> f (Layout x y)
- layout_plots :: forall x y f. Functor f => ([Plot x y] -> f [Plot x y]) -> Layout x y -> f (Layout x y)
- layout_legend :: forall x y f. Functor f => (Maybe LegendStyle -> f (Maybe LegendStyle)) -> Layout x y -> f (Layout x y)
- layout_grid_last :: forall x y f. Functor f => (Bool -> f Bool) -> Layout x y -> f (Layout x y)
- layout_axes_styles :: forall x y f. Settable f => (AxisStyle -> f AxisStyle) -> Layout x y -> f (Layout x y)
- layout_axes_title_styles :: forall x y f. Settable f => (FontStyle -> f FontStyle) -> Layout x y -> f (Layout x y)
- layout_all_font_styles :: forall x y f. Settable f => (FontStyle -> f FontStyle) -> Layout x y -> f (Layout x y)
- layout_foreground :: forall x y f. Settable f => (AlphaColour Double -> f (AlphaColour Double)) -> Layout x y -> f (Layout x y)
- layoutlr_background :: forall x y1 y2 f. Functor f => (FillStyle -> f FillStyle) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_plot_background :: forall x y1 y2 f. Functor f => (Maybe FillStyle -> f (Maybe FillStyle)) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_title :: forall x y1 y2 f. Functor f => (String -> f String) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_title_style :: forall x y1 y2 f. Functor f => (FontStyle -> f FontStyle) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_x_axis :: forall x y1 y2 f. Functor f => (LayoutAxis x -> f (LayoutAxis x)) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_top_axis_visibility :: forall x y1 y2 f. Functor f => (AxisVisibility -> f AxisVisibility) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_bottom_axis_visibility :: forall x y1 y2 f. Functor f => (AxisVisibility -> f AxisVisibility) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_left_axis :: forall x y1 y2 f. Functor f => (LayoutAxis y1 -> f (LayoutAxis y1)) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_right_axis :: forall x y1 y2 f. Functor f => (LayoutAxis y2 -> f (LayoutAxis y2)) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_left_axis_visibility :: forall x y1 y2 f. Functor f => (AxisVisibility -> f AxisVisibility) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_right_axis_visibility :: forall x y1 y2 f. Functor f => (AxisVisibility -> f AxisVisibility) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_plots :: forall x y1 y2 f. Functor f => ([Either (Plot x y1) (Plot x y2)] -> f [Either (Plot x y1) (Plot x y2)]) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_legend :: forall x y1 y2 f. Functor f => (Maybe LegendStyle -> f (Maybe LegendStyle)) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_margin :: forall x y1 y2 f. Functor f => (Double -> f Double) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_grid_last :: forall x y1 y2 f. Functor f => (Bool -> f Bool) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_axes_styles :: forall x y1 y2 f. Settable f => (AxisStyle -> f AxisStyle) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_axes_title_styles :: forall x y1 y2 f. Settable f => (FontStyle -> f FontStyle) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_all_font_styles :: forall x y1 y2 f. Settable f => (FontStyle -> f FontStyle) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- layoutlr_foreground :: forall x y1 y2 f. Settable f => (AlphaColour Double -> f (AlphaColour Double)) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2)
- slayouts_layouts :: forall x1 x2 f. Functor f => ([StackedLayout x1] -> f [StackedLayout x2]) -> StackedLayouts x1 -> f (StackedLayouts x2)
- slayouts_compress_legend :: forall x f. Functor f => (Bool -> f Bool) -> StackedLayouts x -> f (StackedLayouts x)
Types
A Layout value is a single plot area, with single x and y axis. The title is at the top and the legend at the bottom. It's parametrized by the types of values to be plotted on the x and y axes.
Constructors
Layout | |
Fields
|
Instances
(Ord x, Ord y) => ToRenderable (Layout x y) # | |
Defined in Graphics.Rendering.Chart.Layout Methods toRenderable :: Layout x y -> Renderable () # | |
(PlotValue x, PlotValue y) => Default (Layout x y) # | Empty |
Defined in Graphics.Rendering.Chart.Layout |
A LayoutLR value is a single plot area, with an x axis and independent left and right y axes, with a title at the top; legend at the bottom. It's parametrized by the types of values to be plotted on the x and two y axes.
Constructors
LayoutLR | |
Fields
|
Instances
(Ord x, Ord yl, Ord yr) => ToRenderable (LayoutLR x yl yr) # | |
Defined in Graphics.Rendering.Chart.Layout Methods toRenderable :: LayoutLR x yl yr -> Renderable () # | |
(PlotValue x, PlotValue y1, PlotValue y2) => Default (LayoutLR x y1 y2) # | Empty |
Defined in Graphics.Rendering.Chart.Layout |
data LayoutAxis x #
Type of axis that is used in Layout
and LayoutLR
.
To generate the actual axis type (AxisData
and AxisT
)
the _laxis_generate
function is called and custom settings
are applied with _laxis_override
. Note that the AxisVisibility
values in Layout
and LayoutLR
override visibility related
settings of the axis.
Constructors
LayoutAxis | |
Fields
|
Instances
PlotValue t => Default (LayoutAxis t) # | |
Defined in Graphics.Rendering.Chart.Layout Methods def :: LayoutAxis t # |
data LayoutPick x y1 y2 #
Information on what is at a specifc location of a Layout
or LayoutLR
.
This is delivered by the PickFn
of a Renderable
.
Constructors
LayoutPick_Legend String | A legend entry. |
LayoutPick_Title String | The title. |
LayoutPick_XTopAxisTitle String | The title of the top x axis. |
LayoutPick_XBottomAxisTitle String | The title of the bottom x axis. |
LayoutPick_YLeftAxisTitle String | The title of the left y axis. |
LayoutPick_YRightAxisTitle String | The title of the right y axis. |
LayoutPick_PlotArea x y1 y2 | The plot area at the given plot coordinates. |
LayoutPick_XTopAxis x | The top x axis at the given plot coordinate. |
LayoutPick_XBottomAxis x | The bottom x axis at the given plot coordinate. |
LayoutPick_YLeftAxis y1 | The left y axis at the given plot coordinate. |
LayoutPick_YRightAxis y2 | The right y axis at the given plot coordinate. |
Instances
(Show x, Show y1, Show y2) => Show (LayoutPick x y1 y2) # | |
Defined in Graphics.Rendering.Chart.Layout Methods showsPrec :: Int -> LayoutPick x y1 y2 -> ShowS # show :: LayoutPick x y1 y2 -> String # showList :: [LayoutPick x y1 y2] -> ShowS # |
data StackedLayouts x #
A container for a set of vertically StackedLayout
s.
The x axis of the different layouts will be aligned.
Constructors
StackedLayouts | |
Fields
|
Instances
Ord x => ToRenderable (StackedLayouts x) # | |
Defined in Graphics.Rendering.Chart.Layout Methods toRenderable :: StackedLayouts x -> Renderable () # | |
Default (StackedLayouts x) # | A empty |
Defined in Graphics.Rendering.Chart.Layout Methods def :: StackedLayouts x # |
data StackedLayout x #
A layout with its y type hidden, so that it can be stacked
with other layouts with differing y axis, but the same x axis.
See StackedLayouts
.
Constructors
Ord y => StackedLayout (Layout x y) | A |
(Ord yl, Ord yr) => StackedLayoutLR (LayoutLR x yl yr) | A |
type MAxisFn t = [t] -> Maybe (AxisData t) #
A MAxisFn
is a function that generates an (optional) axis
given the points plotted against that axis.
Rendering
layoutToRenderable :: (Ord x, Ord y) => Layout x y -> Renderable (LayoutPick x y y) #
Render the given Layout
.
layoutToGrid :: (Ord x, Ord y) => Layout x y -> Grid (Renderable (LayoutPick x y y)) #
layoutLRToRenderable :: (Ord x, Ord yl, Ord yr) => LayoutLR x yl yr -> Renderable (LayoutPick x yl yr) #
Render the given LayoutLR
.
layoutLRToGrid :: (Ord x, Ord yl, Ord yr) => LayoutLR x yl yr -> Grid (Renderable (LayoutPick x yl yr)) #
renderStackedLayouts :: Ord x => StackedLayouts x -> Renderable () #
Render several layouts with the same x-axis type and range, vertically stacked so that their origins and x-values are aligned.
The legends from all the charts may be optionally combined, and shown
once on the bottom chart. See StackedLayouts
for further information.
LayoutAxis lenses
laxis_title_style :: forall x f. Functor f => (FontStyle -> f FontStyle) -> LayoutAxis x -> f (LayoutAxis x) #
laxis_title :: forall x f. Functor f => (String -> f String) -> LayoutAxis x -> f (LayoutAxis x) #
laxis_style :: forall x f. Functor f => (AxisStyle -> f AxisStyle) -> LayoutAxis x -> f (LayoutAxis x) #
laxis_generate :: forall x f. Functor f => (AxisFn x -> f (AxisFn x)) -> LayoutAxis x -> f (LayoutAxis x) #
laxis_override :: forall x f. Functor f => ((AxisData x -> AxisData x) -> f (AxisData x -> AxisData x)) -> LayoutAxis x -> f (LayoutAxis x) #
laxis_reverse :: forall x f. Functor f => (Bool -> f Bool) -> LayoutAxis x -> f (LayoutAxis x) #
Layout lenses
layout_background :: forall x y f. Functor f => (FillStyle -> f FillStyle) -> Layout x y -> f (Layout x y) #
layout_plot_background :: forall x y f. Functor f => (Maybe FillStyle -> f (Maybe FillStyle)) -> Layout x y -> f (Layout x y) #
layout_title_style :: forall x y f. Functor f => (FontStyle -> f FontStyle) -> Layout x y -> f (Layout x y) #
layout_x_axis :: forall x y f. Functor f => (LayoutAxis x -> f (LayoutAxis x)) -> Layout x y -> f (Layout x y) #
layout_top_axis_visibility :: forall x y f. Functor f => (AxisVisibility -> f AxisVisibility) -> Layout x y -> f (Layout x y) #
layout_bottom_axis_visibility :: forall x y f. Functor f => (AxisVisibility -> f AxisVisibility) -> Layout x y -> f (Layout x y) #
layout_y_axis :: forall x y f. Functor f => (LayoutAxis y -> f (LayoutAxis y)) -> Layout x y -> f (Layout x y) #
layout_left_axis_visibility :: forall x y f. Functor f => (AxisVisibility -> f AxisVisibility) -> Layout x y -> f (Layout x y) #
layout_right_axis_visibility :: forall x y f. Functor f => (AxisVisibility -> f AxisVisibility) -> Layout x y -> f (Layout x y) #
layout_plots :: forall x y f. Functor f => ([Plot x y] -> f [Plot x y]) -> Layout x y -> f (Layout x y) #
layout_legend :: forall x y f. Functor f => (Maybe LegendStyle -> f (Maybe LegendStyle)) -> Layout x y -> f (Layout x y) #
layout_axes_styles :: forall x y f. Settable f => (AxisStyle -> f AxisStyle) -> Layout x y -> f (Layout x y) #
Setter to update all axis styles on a Layout
layout_axes_title_styles :: forall x y f. Settable f => (FontStyle -> f FontStyle) -> Layout x y -> f (Layout x y) #
Setter to update all the axes title styles on a Layout
layout_all_font_styles :: forall x y f. Settable f => (FontStyle -> f FontStyle) -> Layout x y -> f (Layout x y) #
Setter to update all the font styles on a Layout
layout_foreground :: forall x y f. Settable f => (AlphaColour Double -> f (AlphaColour Double)) -> Layout x y -> f (Layout x y) #
Setter to update the foreground color of core chart elements on a Layout
LayoutLR lenses
layoutlr_background :: forall x y1 y2 f. Functor f => (FillStyle -> f FillStyle) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_plot_background :: forall x y1 y2 f. Functor f => (Maybe FillStyle -> f (Maybe FillStyle)) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_title :: forall x y1 y2 f. Functor f => (String -> f String) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_title_style :: forall x y1 y2 f. Functor f => (FontStyle -> f FontStyle) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_x_axis :: forall x y1 y2 f. Functor f => (LayoutAxis x -> f (LayoutAxis x)) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_top_axis_visibility :: forall x y1 y2 f. Functor f => (AxisVisibility -> f AxisVisibility) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_bottom_axis_visibility :: forall x y1 y2 f. Functor f => (AxisVisibility -> f AxisVisibility) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_left_axis :: forall x y1 y2 f. Functor f => (LayoutAxis y1 -> f (LayoutAxis y1)) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_right_axis :: forall x y1 y2 f. Functor f => (LayoutAxis y2 -> f (LayoutAxis y2)) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_left_axis_visibility :: forall x y1 y2 f. Functor f => (AxisVisibility -> f AxisVisibility) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_right_axis_visibility :: forall x y1 y2 f. Functor f => (AxisVisibility -> f AxisVisibility) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_plots :: forall x y1 y2 f. Functor f => ([Either (Plot x y1) (Plot x y2)] -> f [Either (Plot x y1) (Plot x y2)]) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_legend :: forall x y1 y2 f. Functor f => (Maybe LegendStyle -> f (Maybe LegendStyle)) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_margin :: forall x y1 y2 f. Functor f => (Double -> f Double) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_grid_last :: forall x y1 y2 f. Functor f => (Bool -> f Bool) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
layoutlr_axes_styles :: forall x y1 y2 f. Settable f => (AxisStyle -> f AxisStyle) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
Setter to update all axis styles on a LayoutLR
layoutlr_axes_title_styles :: forall x y1 y2 f. Settable f => (FontStyle -> f FontStyle) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
Setter to update all the axes title styles on a LayoutLR
layoutlr_all_font_styles :: forall x y1 y2 f. Settable f => (FontStyle -> f FontStyle) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
Setter to update all the font styles on a LayoutLR
layoutlr_foreground :: forall x y1 y2 f. Settable f => (AlphaColour Double -> f (AlphaColour Double)) -> LayoutLR x y1 y2 -> f (LayoutLR x y1 y2) #
Setter to update the foreground color of core chart elements on a LayoutLR
StackedLayouts lenses
slayouts_layouts :: forall x1 x2 f. Functor f => ([StackedLayout x1] -> f [StackedLayout x2]) -> StackedLayouts x1 -> f (StackedLayouts x2) #
slayouts_compress_legend :: forall x f. Functor f => (Bool -> f Bool) -> StackedLayouts x -> f (StackedLayouts x) #