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

Safe HaskellNone

Graphics.Rendering.Chart.Axis

Description

 

Synopsis

Documentation

data Axis Source

The concrete data type for an axis

Constructors

Axis 

Fields

axis_viewport :: Range -> Double -> Double

The axis_viewport function maps values into device cordinates.

axis_ticks :: [(Double, 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 number are drawn towards the plot area.

axis_labels :: [(Double, String)]

The labels on an axis as pairs. The first element is the position on the axis (in viewport units) and the second is the label text string.

axis_grid :: [Double]

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

axis_label_gap :: Double

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

axis_line_style :: CairoLineStyle
 
axis_label_style :: CairoFontStyle
 
axis_grid_style :: CairoLineStyle
 

type AxisFn = [Double] -> Maybe AxisSource

Function type to generate an optional axis given a set of points to be plotted against that axis.

type AxesFn = [Double] -> [Double] -> (Maybe Axis, Maybe Axis)Source

Function type to generate a pair of axes (either top and bottom, or left and right), given the set of points to be plotted against each of them.

data AxisT Source

Constructors

AxisT RectEdge Axis 

Instances

axisOverhang :: AxisT -> Render (Double, Double)Source

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

strokeLines' :: Bool -> [Point] -> Render ()Source

Same as strokeLines, but with a flag that, when true will adjust each point to land on a whole number. This is useful for drawing known horizontal and vertical lines so that the occupy exactly

explicitAxis :: Maybe Axis -> AxisFnSource

Explicitly specify an axis

autoScaledAxis :: Axis -> AxisFnSource

Generate a linear axis automatically. The supplied axis is used as a template, with the viewport, ticks, labels and grid set appropriately for the data displayed against that axies. The resulting axis will only show a grid if the template has some grid values.

log10 :: Floating a => a -> aSource

frac :: (Integral t, RealFrac t1) => t1 -> (t, t1)Source

autoScaledLogAxis :: Axis -> AxisFnSource

Generate a log axis automatically. The supplied axis is used as a template, with the viewport, ticks, labels and grid set appropriately for the data displayed against that axies. The resulting axis will only show a grid if the template has some grid values.

independentAxes :: AxisFn -> AxisFn -> AxesFnSource

Show independent axes on each side of the layout

linkedAxes :: AxisFn -> AxesFnSource

Show the same axis on both sides of the layout

linkedAxes' :: AxisFn -> AxesFnSource

Show the same axis on both sides of the layout, but with labels only on the primary side

doubleFromClockTime :: ClockTime -> DoubleSource

Map a clocktime value to a plot cordinate

clockTimeFromDouble :: Double -> ClockTimeSource

Map a plot cordinate to a clocktime

monthsAxis :: Axis -> AxisFnSource

An axis that plots dates, with ticks and labels corresponding to calendar months. The values to be plotted against this axis can be created with doubleFromClockTime