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

Safe Haskell | None

Graphics.Rendering.Chart.Axis.Types

Description

Type definitions for Axes

Synopsis

- data AxisData x = AxisData {
  - axis_viewport_ :: Range -> x -> Double
  - axis_tropweiv_ :: Range -> Double -> x
  - axis_ticks_ :: [(x, Double)]
  - axis_labels_ :: [[(x, String)]]
  - axis_grid_ :: [x]
  }
- data AxisT x = AxisT RectEdge AxisStyle Bool (AxisData x)
- data AxisStyle = AxisStyle {
  - axis_line_style_ :: CairoLineStyle
  - axis_label_style_ :: CairoFontStyle
  - axis_grid_style_ :: CairoLineStyle
  - axis_label_gap_ :: Double
  }
- class Ord a => PlotValue a where
  - toValue :: a -> Double
  - fromValue :: Double -> a
  - autoAxis :: AxisFn a
- type AxisFn x = [x] -> AxisData x
- defaultAxisLineStyle :: CairoLineStyle
- defaultAxisStyle :: AxisStyle
- defaultGridLineStyle :: CairoLineStyle
- makeAxis :: PlotValue x => (x -> String) -> ([x], [x], [x]) -> AxisData x
- makeAxis' :: Ord x => (x -> Double) -> (Double -> x) -> (x -> String) -> ([x], [x], [x]) -> AxisData x
- axisToRenderable :: AxisT x -> Renderable x
- renderAxisGrid :: RectSize -> AxisT z -> CRender ()
- axisOverhang :: Ord x => AxisT x -> CRender (Double, Double)
- vmap :: PlotValue x => (x, x) -> Range -> x -> Double
- invmap :: PlotValue x => (x, x) -> Range -> Double -> x
- linMap :: (a -> Double) -> (a, a) -> Range -> a -> Double
- invLinMap :: (Double -> a) -> (a -> Double) -> (a, a) -> Range -> Double -> a
- axisGridAtTicks :: AxisData x -> AxisData x
- axisGridAtBigTicks :: AxisData x -> AxisData x
- axisGridAtLabels :: AxisData x -> AxisData x
- axisGridHide :: AxisData x -> AxisData x
- axisTicksHide :: AxisData x -> AxisData x
- axisLabelsHide :: AxisData x -> AxisData x
- axisLabelsOverride :: [(x, String)] -> AxisData x -> AxisData x
- axis_viewport :: forall x. T (AxisData x) (Range -> x -> Double)
- axis_tropweiv :: forall x. T (AxisData x) (Range -> Double -> x)
- axis_ticks :: forall x. T (AxisData x) [(x, Double)]
- axis_labels :: forall x. T (AxisData x) [[(x, String)]]
- axis_grid :: forall x. T (AxisData x) [x]
- axis_line_style :: T AxisStyle CairoLineStyle
- axis_label_style :: T AxisStyle CairoFontStyle
- axis_grid_style :: T AxisStyle CairoLineStyle
- axis_label_gap :: T AxisStyle Double

# Documentation

data AxisData x Source

The basic data associated with an axis showing values of type x.

Constructors

AxisData |

Fields

axis_viewport_ :: Range -> x -> Double

  The axis_viewport_ function maps values into device coordinates.

axis_tropweiv_ :: Range -> Double -> x

  The axis_tropweiv_ function maps device coordinates back to values.

axis_ticks_ :: [(x, Double)]

  The tick marks on the axis as pairs. The first element is the position on the axis (in viewport units) and the second element is the length of the tick in output coordinates. The tick starts on the axis, and positive numbers are drawn towards the plot area.

axis_labels_ :: [[(x, String)]]

  The labels on an axis as pairs. The first element of the pair is the position on the axis (in viewport units) and the second is the label text string. Note that multiple sets of labels can be specified, and are shown successively further away from the axis line.

axis_grid_ :: [x]

  The positions on the axis (in viewport units) where we want to show grid lines.

data AxisT x Source

Collect the information we need to render an axis. The bool is true if the axis direction is reversed.

Constructors

AxisT RectEdge AxisStyle Bool (AxisData x) |

data AxisStyle Source

Control values for how an axis gets displayed.

Constructors

AxisStyle |

Fields

axis_line_style_ :: CairoLineStyle
axis_label_style_ :: CairoFontStyle
axis_grid_style_ :: CairoLineStyle
axis_label_gap_ :: Double

  How far the labels are to be drawn from the axis.

class Ord a => PlotValue a where Source

A typeclass abstracting the functions we need to be able to plot against an axis of type a

Methods

toValue :: a -> Double Source

fromValue :: Double -> aSource

autoAxis :: AxisFn aSource

Instances

PlotValue Double |
PlotValue Int |
PlotValue Integer |
PlotValue () |
PlotValue LocalTime |
PlotValue PlotIndex |
PlotValue LogValue |
PlotValue Percent |

type AxisFn x = [x] -> AxisData xSource

A function to generate the axis data, given the data values to be plotted against it.

defaultAxisLineStyle :: CairoLineStyle Source

defaultAxisStyle :: AxisStyle Source

defaultGridLineStyle :: CairoLineStyle Source

makeAxis :: PlotValue x => (x -> String) -> ([x], [x], [x]) -> AxisData xSource

Construct an axis given the positions for ticks, grid lines, and labels, and the labelling function

makeAxis' :: Ord x => (x -> Double) -> (Double -> x) -> (x -> String) -> ([x], [x], [x]) -> AxisData xSource

Construct an axis given the positions for ticks, grid lines, and labels, and the positioning and labelling functions

axisToRenderable :: AxisT x -> Renderable xSource

Construct a renderable from an axis, in order that it can be composed with other renderables and drawn. This does not include the drawing of the grid, which must be done separately by the `renderAxisGrid` function.

renderAxisGrid :: RectSize -> AxisT z -> CRender ()Source

axisOverhang :: Ord x => AxisT x -> CRender (Double, Double)Source

Calculate the amount by which the labels extend beyond the ends of the axis.

vmap :: PlotValue x => (x, x) -> Range -> x -> Double Source

A linear mapping of points in one range to another.

invmap :: PlotValue x => (x, x) -> Range -> Double -> xSource

The inverse mapping from device co-ordinate range back to interesting values.

linMap :: (a -> Double) -> (a, a) -> Range -> a -> Double Source

A linear mapping of points in one range to another.

invLinMap :: (Double -> a) -> (a -> Double) -> (a, a) -> Range -> Double -> aSource

An inverse linear mapping of points from one range to another.

axisGridAtTicks :: AxisData x -> AxisData xSource

Modifier to position grid lines to line up with the ticks

axisGridAtBigTicks :: AxisData x -> AxisData xSource

Modifier to position grid lines to line up with only the major ticks

axisGridAtLabels :: AxisData x -> AxisData xSource

Modifier to position grid lines to line up with the labels

axisGridHide :: AxisData x -> AxisData xSource

Modifier to remove grid lines from an axis

axisTicksHide :: AxisData x -> AxisData xSource

Modifier to remove ticks from an axis

axisLabelsHide :: AxisData x -> AxisData xSource

Modifier to remove labels from an axis

axisLabelsOverride :: [(x, String)] -> AxisData x -> AxisData xSource

Modifier to change labels on an axis

axis_viewport :: forall x. T (AxisData x) (Range -> x -> Double)Source

axis_tropweiv :: forall x. T (AxisData x) (Range -> Double -> x)Source

axis_ticks :: forall x. T (AxisData x) [(x, Double)]Source

axis_labels :: forall x. T (AxisData x) [[(x, String)]]Source

axis_grid :: forall x. T (AxisData x) [x]Source

axis_line_style :: T AxisStyle CairoLineStyle Source

axis_label_style :: T AxisStyle CairoFontStyle Source

axis_grid_style :: T AxisStyle CairoLineStyle Source

axis_label_gap :: T AxisStyle Double Source