Code to calculate and render axes.
Note that template haskell is used to derive accessor functions
(see Data.Accessor
) for each field of the following data types:
These accessors are not shown in this API documentation. They have the same name as the field, but with the trailing underscore dropped. Hence for data field f_::F in type D, they have type
f :: Data.Accessor.Accessor D F
- data AxisData x = AxisData {
- axis_viewport_ :: Range -> x -> Double
- axis_ticks_ :: [(x, Double)]
- axis_labels_ :: [(x, String)]
- axis_grid_ :: [x]
- data AxisT x = AxisT RectEdge AxisStyle Bool (AxisData x)
- data LinearAxisParams a = LinearAxisParams {
- la_labelf_ :: a -> String
- la_nLabels_ :: Int
- la_nTicks_ :: Int
- data LogAxisParams a = LogAxisParams {
- loga_labelf_ :: a -> String
- data AxisStyle = AxisStyle {}
- class Ord a => PlotValue a where
- newtype LogValue = LogValue Double
- newtype PlotIndex = PlotIndex {
- plotindex_i :: Int
- type AxisFn x = [x] -> AxisData x
- defaultAxisLineStyle :: CairoLineStyle
- defaultLinearAxis :: Show a => LinearAxisParams a
- defaultIntAxis :: Show a => LinearAxisParams a
- defaultLogAxis :: Show a => LogAxisParams a
- defaultAxisStyle :: AxisStyle
- autoScaledAxis :: RealFloat a => LinearAxisParams a -> AxisFn a
- autoScaledLogAxis :: RealFloat a => LogAxisParams a -> AxisFn a
- unitAxis :: AxisData ()
- timeAxis :: TimeSeq -> TimeSeq -> TimeLabelFn -> AxisFn LocalTime
- autoTimeAxis :: AxisFn LocalTime
- days :: TimeSeq
- months :: TimeSeq
- years :: TimeSeq
- autoIndexAxis :: Integral i => [String] -> [i] -> AxisData i
- addIndexes :: [a] -> [(PlotIndex, a)]
- autoSteps :: Int -> [Double] -> [Double]
- 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
- axisGridAtTicks :: AxisData x -> AxisData x
- axisGridAtLabels :: AxisData x -> AxisData x
- axisGridHide :: AxisData x -> AxisData x
- axisTicksHide :: AxisData x -> AxisData x
- axisLabelsHide :: AxisData x -> AxisData x
- axis_viewport :: forall x[afL6]. T (AxisData x[afL6]) (Range -> x[afL6] -> Double)
- axis_ticks :: forall x[afL6]. T (AxisData x[afL6]) ([] ((,) x[afL6] Double))
- axis_labels :: forall x[afL6]. T (AxisData x[afL6]) ([] ((,) x[afL6] String))
- axis_grid :: forall x[afL6]. T (AxisData x[afL6]) ([] x[afL6])
- axis_line_style :: T AxisStyle CairoLineStyle
- axis_label_style :: T AxisStyle CairoFontStyle
- axis_grid_style :: T AxisStyle CairoLineStyle
- axis_label_gap :: T AxisStyle Double
- la_labelf :: forall a[afL3]. T (LinearAxisParams a[afL3]) (a[afL3] -> String)
- la_nLabels :: forall a[afL3]. T (LinearAxisParams a[afL3]) Int
- la_nTicks :: forall a[afL3]. T (LinearAxisParams a[afL3]) Int
- loga_labelf :: forall a[afL2]. T (LogAxisParams a[afL2]) (a[afL2] -> String)
Documentation
The basic data associated with an axis showing values of type x.
AxisData | |
|
Collect the information we need to render an axis. The bool is true if the axis direction is reversed.
ToRenderable (AxisT x) |
data LinearAxisParams a Source
LinearAxisParams | |
|
data LogAxisParams a Source
LogAxisParams | |
|
Control values for how an axis gets displayed.
AxisStyle | |
|
Type for capturing values plotted by index number (ie position in a list) rather than a numerical value.
type AxisFn x = [x] -> AxisData xSource
A function to generate the axis data, given the data values to be plotted against it.
defaultLinearAxis :: Show a => LinearAxisParams aSource
defaultIntAxis :: Show a => LinearAxisParams aSource
defaultLogAxis :: Show a => LogAxisParams aSource
autoScaledAxis :: RealFloat a => LinearAxisParams a -> AxisFn aSource
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.
autoScaledLogAxis :: RealFloat a => LogAxisParams a -> AxisFn aSource
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 axis. The resulting axis will only show a grid if the template has some grid values.
timeAxis :: TimeSeq -> TimeSeq -> TimeLabelFn -> AxisFn LocalTimeSource
Create an AxisFn
to for a time axis. The first TimeSeq
sets the
minor ticks, and the ultimate range will be aligned to its elements.
The second TimeSeq
sets the labels and grid. The TimeLabelFn
is
used to format LocalTimes for labels. The values to be plotted
against this axis can be created with doubleFromLocalTime
.
autoTimeAxis :: AxisFn LocalTimeSource
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 doubleFromLocalTime
.
autoIndexAxis :: Integral i => [String] -> [i] -> AxisData iSource
Create an axis for values indexed by position. The list of strings are the labels to be used.
addIndexes :: [a] -> [(PlotIndex, a)]Source
Augment a list of values with index numbers for plotting.
autoSteps :: Int -> [Double] -> [Double]Source
Given a target number of values, and a list of input points, find evenly spaced values from the set {1*X, 2*X, 2.5*X, 5*X} (where X is some power of ten) that evenly cover the input points.
axisToRenderable :: AxisT x -> Renderable xSource
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 -> DoubleSource
A linear mapping of points in one range to another.
axisGridAtTicks :: AxisData x -> AxisData xSource
axisGridAtLabels :: AxisData x -> AxisData xSource
axisGridHide :: AxisData x -> AxisData xSource
axisTicksHide :: AxisData x -> AxisData xSource
axisLabelsHide :: AxisData x -> AxisData xSource
la_labelf :: forall a[afL3]. T (LinearAxisParams a[afL3]) (a[afL3] -> String)Source
la_nLabels :: forall a[afL3]. T (LinearAxisParams a[afL3]) IntSource
la_nTicks :: forall a[afL3]. T (LinearAxisParams a[afL3]) IntSource
loga_labelf :: forall a[afL2]. T (LogAxisParams a[afL2]) (a[afL2] -> String)Source