Chart-0.7: 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_title :: String

The title string to be displayed on the axis. An empty string means no title.

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_title_style :: CairoFontStyle
 
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 -> CRender (Double, Double)Source

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

explicitAxis :: Maybe Axis -> AxisFnSource

Explicitly specify an axis

autoAxis :: (Double -> [Char]) -> ((Double, Double) -> Range -> Double -> Double) -> ([Rational], [Rational]) -> Axis -> Maybe AxisSource

autoScaledAxis' :: (Double -> String) -> 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.

autoScaledAxis :: Axis -> AxisFnSource

Generate a linear axis automatically. Same as autoScaledAxis', but with labels generated with showD (showD is show for doubles, but with any trailing .0 removed)

showD :: Show a => a -> [Char]Source

log10 :: Floating a => a -> aSource

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

autoScaledLogAxis' :: (Double -> String) -> 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.

autoScaledLogAxis :: Axis -> AxisFnSource

Generate a log axis automatically. Same as autoScaledLogAxis', but with labels generated with showD (showD is show for doubles, but with any trailing .0 removed)

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

type TimeSeq = ClockTime -> ([ClockTime], [ClockTime])Source

TimeSeq is a (potentially infinite) set of times. When passes a reference time, the function returns a a pair of lists. The first contains all times in the set less than the reference time in decreasing order. The second contains all times in the set greater than or equal to the reference time, in increasing order.

coverTS :: Ord a => (a -> ([a], [a])) -> a -> a -> [a]Source

enumerateTS :: Ord a => (a -> ([a], [a])) -> a -> a -> [a]Source

elemTS :: Eq a => a -> (a -> (t, [a])) -> BoolSource

type TimeLabelFn = ClockTime -> StringSource

How to display a time

formatTime :: String -> TimeLabelFnSource

Use an strftime() formatted string to display a time

timeAxis :: TimeSeq -> TimeSeq -> TimeLabelFn -> Axis -> AxisFnSource

Create an AxisFn to for a time axis. The first TimeSeq sets the minor ticks, and the ultimate range will aligned to it's elements. The second TimeSeq sets the labels and grid. The TimeLabelFn is used to format clocktimes for labels. The values to be plotted against this axis can be created with doubleFromClockTime

days :: TimeSeqSource

A TimeSeq for calendar days

months :: TimeSeqSource

A TimeSeq for calendar months

years :: TimeSeqSource

A TimeSeq for calendar years

autoTimeAxis :: Axis -> AxisFnSource

Automatically choose a suitable time axis, based upon the time range of data. The values to be plotted against this axis can be created with doubleFromClockTime