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

Copyright | (c) Tim Docker 2006 2014
License | BSD-style (see chart/COPYRIGHT)
Safe Haskell | None
Language | Haskell98

Graphics.Rendering.Chart.Axis.Types

Description

Type definitions for Axes

Synopsis

- data AxisData x = AxisData {
  - _axis_visibility :: AxisVisibility
  - _axis_viewport :: Range -> x -> Double
  - _axis_tropweiv :: Range -> Double -> x
  - _axis_ticks :: [(x, Double)]
  - _axis_labels :: [[(x, String)]]
  - _axis_grid :: [x]
  }
- data AxisVisibility = AxisVisibility {
  - _axis_show_line :: Bool
  - _axis_show_ticks :: Bool
  - _axis_show_labels :: Bool
  }
- data AxisT x = AxisT RectEdge AxisStyle Bool (AxisData x)
- data AxisStyle = AxisStyle {
  - _axis_line_style :: LineStyle
  - _axis_label_style :: FontStyle
  - _axis_grid_style :: LineStyle
  - _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 :: LineStyle
- defaultGridLineStyle :: LineStyle
- 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 -> BackendProgram ()
- axisOverhang :: Ord x => AxisT x -> BackendProgram (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
- axisLabelsOverride :: [(x, String)] -> AxisData x -> AxisData x
- axis_show_line :: Lens' AxisVisibility Bool
- axis_show_ticks :: Lens' AxisVisibility Bool
- axis_show_labels :: Lens' AxisVisibility Bool
- axis_visibility :: forall x f. Functor f => (AxisVisibility -> f AxisVisibility) -> AxisData x -> f (AxisData x)
- axis_viewport :: forall x f. Functor f => ((Range -> x -> Double) -> f (Range -> x -> Double)) -> AxisData x -> f (AxisData x)
- axis_tropweiv :: forall x f. Functor f => ((Range -> Double -> x) -> f (Range -> Double -> x)) -> AxisData x -> f (AxisData x)
- axis_ticks :: forall x f. Functor f => ([(x, Double)] -> f [(x, Double)]) -> AxisData x -> f (AxisData x)
- axis_labels :: forall x f. Functor f => ([[(x, String)]] -> f [[(x, String)]]) -> AxisData x -> f (AxisData x)
- axis_grid :: forall x f. Functor f => ([x] -> f [x]) -> AxisData x -> f (AxisData x)
- axis_line_style :: Lens' AxisStyle LineStyle
- axis_label_style :: Lens' AxisStyle FontStyle
- axis_grid_style :: Lens' AxisStyle LineStyle
- axis_label_gap :: Lens' AxisStyle Double

# Documentation

data AxisData x #

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

Constructors

AxisData |
Fields _axis_visibility :: AxisVisibility Which parts of the axis shall be displayed. _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 AxisVisibility #

Configures whick visual elements of a axis are shown at the appropriate edge of a plot area.

Constructors

AxisVisibility |
Fields _axis_show_line :: Bool Whether to display a line along the axis. _axis_show_ticks :: Bool Whether to display the tick marks. _axis_show_labels :: Bool Whether to display the labels.

#### Instances

Instances details

Default AxisVisibility # | By default all parts of a axis are visible.
Instance details Defined in Graphics.Rendering.Chart.Axis.Types Methods def :: AxisVisibility #

data AxisT x #

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 #

Control values for how an axis gets displayed.

Constructors

AxisStyle |
Fields _axis_line_style :: LineStyle `LineStyle` to use for axis line and ticks. _axis_label_style :: FontStyle `FontStyle` to use for axis labels. _axis_grid_style :: LineStyle `LineStyle` to use for axis grid. _axis_label_gap :: Double How far the labels are to be drawn from the axis.

#### Instances

Instances details

Default AxisStyle # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Types Methods def :: AxisStyle #

class Ord a => PlotValue a where #

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

Methods

toValue :: a -> Double #

fromValue :: Double -> a #

autoAxis :: AxisFn a #

#### Instances

Instances details

PlotValue LogValue # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Floating Methods toValue :: LogValue -> Double # fromValue :: Double -> LogValue # autoAxis :: AxisFn LogValue #
PlotValue Percent # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Floating Methods toValue :: Percent -> Double # fromValue :: Double -> Percent # autoAxis :: AxisFn Percent #
PlotValue PlotIndex # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Indexed Methods toValue :: PlotIndex -> Double # fromValue :: Double -> PlotIndex # autoAxis :: AxisFn PlotIndex #
PlotValue Int16 # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Int Methods toValue :: Int16 -> Double # fromValue :: Double -> Int16 # autoAxis :: AxisFn Int16 #
PlotValue Int32 # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Int Methods toValue :: Int32 -> Double # fromValue :: Double -> Int32 # autoAxis :: AxisFn Int32 #
PlotValue Int64 # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Int Methods toValue :: Int64 -> Double # fromValue :: Double -> Int64 # autoAxis :: AxisFn Int64 #
PlotValue Int8 # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Int Methods toValue :: Int8 -> Double # fromValue :: Double -> Int8 # autoAxis :: AxisFn Int8 #
PlotValue Word16 # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Int Methods toValue :: Word16 -> Double # fromValue :: Double -> Word16 # autoAxis :: AxisFn Word16 #
PlotValue Word32 # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Int Methods toValue :: Word32 -> Double # fromValue :: Double -> Word32 # autoAxis :: AxisFn Word32 #
PlotValue Word64 # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Int Methods toValue :: Word64 -> Double # fromValue :: Double -> Word64 # autoAxis :: AxisFn Word64 #
PlotValue Word8 # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Int Methods toValue :: Word8 -> Double # fromValue :: Double -> Word8 # autoAxis :: AxisFn Word8 #
PlotValue Day # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Time Methods toValue :: Day -> Double # fromValue :: Double -> Day # autoAxis :: AxisFn Day #
PlotValue UTCTime # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Time Methods toValue :: UTCTime -> Double # fromValue :: Double -> UTCTime # autoAxis :: AxisFn UTCTime #
PlotValue LocalTime # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Time Methods toValue :: LocalTime -> Double # fromValue :: Double -> LocalTime # autoAxis :: AxisFn LocalTime #
PlotValue Integer # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Int Methods toValue :: Integer -> Double # fromValue :: Double -> Integer # autoAxis :: AxisFn Integer #
PlotValue () # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Unit Methods toValue :: () -> Double # fromValue :: Double -> () # autoAxis :: AxisFn () #
PlotValue Double # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Floating Methods toValue :: Double -> Double # fromValue :: Double -> Double # autoAxis :: AxisFn Double #
PlotValue Float # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Floating Methods toValue :: Float -> Double # fromValue :: Double -> Float # autoAxis :: AxisFn Float #
PlotValue Int # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Int Methods toValue :: Int -> Double # fromValue :: Double -> Int # autoAxis :: AxisFn Int #
PlotValue Word # |
Instance details Defined in Graphics.Rendering.Chart.Axis.Int Methods toValue :: Word -> Double # fromValue :: Double -> Word # autoAxis :: AxisFn Word #

type AxisFn x = [x] -> AxisData x #

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

defaultAxisLineStyle :: LineStyle #

The default `LineStyle` of an axis.

defaultGridLineStyle :: LineStyle #

The default `LineStyle` of a plot area grid.

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

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 x #

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

axisToRenderable :: AxisT x -> Renderable x #

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 -> BackendProgram () #

axisOverhang :: Ord x => AxisT x -> BackendProgram (Double, Double) #

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

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

A linear mapping of points in one range to another.

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

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

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

A linear mapping of points in one range to another.

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

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

axisGridAtTicks :: AxisData x -> AxisData x #

Modifier to position grid lines to line up with the ticks

axisGridAtBigTicks :: AxisData x -> AxisData x #

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

axisGridAtLabels :: AxisData x -> AxisData x #

Modifier to position grid lines to line up with the labels

axisGridHide :: AxisData x -> AxisData x #

Modifier to remove grid lines from an axis

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

Modifier to change labels on an axis

axis_show_line :: Lens' AxisVisibility Bool #

axis_show_ticks :: Lens' AxisVisibility Bool #

axis_show_labels :: Lens' AxisVisibility Bool #

axis_visibility :: forall x f. Functor f => (AxisVisibility -> f AxisVisibility) -> AxisData x -> f (AxisData x) #

axis_viewport :: forall x f. Functor f => ((Range -> x -> Double) -> f (Range -> x -> Double)) -> AxisData x -> f (AxisData x) #

axis_tropweiv :: forall x f. Functor f => ((Range -> Double -> x) -> f (Range -> Double -> x)) -> AxisData x -> f (AxisData x) #

axis_ticks :: forall x f. Functor f => ([(x, Double)] -> f [(x, Double)]) -> AxisData x -> f (AxisData x) #

axis_labels :: forall x f. Functor f => ([[(x, String)]] -> f [[(x, String)]]) -> AxisData x -> f (AxisData x) #

axis_grid :: forall x f. Functor f => ([x] -> f [x]) -> AxisData x -> f (AxisData x) #

axis_line_style :: Lens' AxisStyle LineStyle #

axis_label_style :: Lens' AxisStyle FontStyle #

axis_grid_style :: Lens' AxisStyle LineStyle #

axis_label_gap :: Lens' AxisStyle Double #