Copyright | (C) 2015 Christopher Chalmers |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Christopher Chalmers |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Ticks for being placed on an axis or a ColourBar
.
- data MajorTicks v n
- class HasMajorTicks f a where
- majorTicksHelper :: (RealFrac n, Floating n) => [n] -> n -> (n, n) -> [n]
- logMajorTicks :: (RealFrac n, Floating n) => n -> (n, n) -> [n]
- data MinorTicks v n
- class HasMinorTicks f a where
- minorTicksHelper :: Fractional n => Int -> [n] -> (n, n) -> [n]
- data Ticks v n
- class (HasMinorTicks f a, HasMajorTicks f a) => HasTicks f a where
- ticksAlign :: (HasTicks f a, Applicative f) => LensLike' f a TicksAlignment
- ticksStyle :: (HasTicks f a, Applicative f) => LensLike' f a (Style (V a) (N a))
- ticksVisible :: (HasTicks f a, Applicative f) => LensLike' f a Bool
- data TicksAlignment
- autoTicks :: TicksAlignment
- centreTicks :: TicksAlignment
- centerTicks :: TicksAlignment
- insideTicks :: TicksAlignment
- outsideTicks :: TicksAlignment
- hideTicks :: HasTicks Identity a => a -> a
- majorTickPositions :: (HasMajorTicks f a, Settable f) => LensLike' f a [N a]
- minorTickPositions :: (HasMinorTicks f a, Settable f) => LensLike' f a [N a]
- linearMajorTicks :: (RealFrac n, Floating n) => n -> (n, n) -> [n]
Major ticks
data MajorTicks v n Source #
The big ticks on the axis line.
HasMajorTicks f (MajorTicks v n) Source # | |
TypeableFloat n => Default (MajorTicks v n) Source # | |
HasVisibility (MajorTicks v n) Source # | |
type V (MajorTicks v n) Source # | |
type N (MajorTicks v n) Source # | |
class HasMajorTicks f a where Source #
Class of things that have a MajorTicks
.
majorTicks :: LensLike' f a (MajorTicks (V a) (N a)) Source #
Lens onto the MajorTicks
of something.
majorTicksFunction :: Functor f => LensLike' f a ((N a, N a) -> [N a]) Source #
The function used to place ticks for this axis, given the bounds
of the axis. The result of these major ticks are also used as
guides for MinorTicks
, MajorGridLines
and MinorGridLines
.
Default is
.linearMinorTicks
5
majorTicksAlignment :: Functor f => LensLike' f a TicksAlignment Source #
Alignment of the major ticks. Choose between autoTicks
(default), centreTicks
, insideTicks
or outsideTicks
.
majorTicksLength :: Functor f => LensLike' f a (N a) Source #
The total length the major ticks.
Default is 7
.
majorTicksStyle :: Functor f => LensLike' f a (Style (V a) (N a)) Source #
Functor f => HasMajorTicks f (Ticks v n) Source # | |
HasMajorTicks f (MajorTicks v n) Source # | |
Functor f => HasMajorTicks f (ColourBar b n) Source # | |
(Applicative f, Traversable c) => HasMajorTicks f (Axis b c n) Source # | |
Functor f => HasMajorTicks f (SingleAxis b v n) Source # | |
:: (RealFrac n, Floating n) | |
=> [n] | Allowed numbers (up to powers of 10) |
-> n | desired number of ticks |
-> (n, n) | bounds |
-> [n] | tick positions |
Choose ticks whose step size is a multiple of 10 of the allowed numbers and tries to match the number of desired ticks.
Note that the resulting tick positions may go out of the range of the bounds. This is so the minor ticks can be chosen correctly if a tick doesn't end exactly on a bound. When we render, we ignore all ticks outside the bounds.
logMajorTicks :: (RealFrac n, Floating n) => n -> (n, n) -> [n] Source #
Place n ticks at powers of 10 on the axis.
Minor ticks
data MinorTicks v n Source #
The small ticks on the axis line.
HasMinorTicks f (MinorTicks v n) Source # | |
TypeableFloat n => Default (MinorTicks v n) Source # | |
HasVisibility (MinorTicks v n) Source # | |
type V (MinorTicks v n) Source # | |
type N (MinorTicks v n) Source # | |
class HasMinorTicks f a where Source #
Class of things that have a single MinorTicks
.
minorTicks :: LensLike' f a (MinorTicks (V a) (N a)) Source #
Lens onto the MinorTicks
of something.
minorTicksFunction :: Functor f => LensLike' f a ([N a] -> (N a, N a) -> [N a]) Source #
The function used to place ticks for this axis, given the result
of majorTicksFunction
and the bounds of the axis.
Default is
.linearMinorTicks
3
minorTicksAlignment :: Functor f => LensLike' f a TicksAlignment Source #
Alignment of the minor ticks. Choose between autoTicks
(default), centreTicks
, insideTicks
or outsideTicks
.
minorTicksLength :: Functor f => LensLike' f a (N a) Source #
The total length the minor ticks.
Default is 3
.
minorTicksStyle :: Functor f => LensLike' f a (Style (V a) (N a)) Source #
Functor f => HasMinorTicks f (Ticks v n) Source # | |
HasMinorTicks f (MinorTicks v n) Source # | |
(Applicative f, Traversable c) => HasMinorTicks f (Axis b c n) Source # | |
Functor f => HasMinorTicks f (SingleAxis b v n) Source # | |
:: Fractional n | |
=> Int | Number of minor ticks between each major tick |
-> [n] | Positions of major ticks |
-> (n, n) | Bounds |
-> [n] | Minor tick positions |
Place n linear spaced ticks between each major tick.
Both major and minor ticks
Both MajorTicks
and MinorTicks
together.
class (HasMinorTicks f a, HasMajorTicks f a) => HasTicks f a where Source #
Class of things with both MajorTicks
and MinorTicks
.
ticksAlign :: (HasTicks f a, Applicative f) => LensLike' f a TicksAlignment Source #
Traversal over both major and minor tick alignment.
ticksStyle :: (HasTicks f a, Applicative f) => LensLike' f a (Style (V a) (N a)) Source #
Traversal over both major and minor tick styles.
ticksVisible :: (HasTicks f a, Applicative f) => LensLike' f a Bool Source #
Traversal over the visibility of both major and minor ticks.
Tick alignment
data TicksAlignment Source #
Set the portion of the tick above and below the axis.
autoTicks :: TicksAlignment Source #
Set the tick type depending on the axis line position. centreTick
for middleAxis
, insideTick
for everything else.
centreTicks :: TicksAlignment Source #
Set the tick to be in the centre of the axis with total length of the corresponding tick length.
centerTicks :: TicksAlignment Source #
Synonym for centreTicks
.
insideTicks :: TicksAlignment Source #
Align the ticks to be inside a box axis.
outsideTicks :: TicksAlignment Source #
Align the ticks to be outside a box axis.
Helper functions
hideTicks :: HasTicks Identity a => a -> a Source #
Hides the Minor
ticks when trying to render something. This can
be used on multiple types:
hideTicks
::Axis
b c n ->Axis
b c nhideTicks
::SingleAxis
b v n ->SingleAxis
b v nhideTicks
::Ticks
v n ->Ticks
v nhideTicks
::MinorTicks
v n ->MinorTicks
v n
majorTickPositions :: (HasMajorTicks f a, Settable f) => LensLike' f a [N a] Source #
Setter over the final positions the major ticks. This is not as
general as majorTicksFunction
because you don't have access to
the bounds but it can be useful when you know exactly what ticks
you want to add or modify existing tick positions.
minorTickPositions :: (HasMinorTicks f a, Settable f) => LensLike' f a [N a] Source #
Setter over the final positions the major ticks. This is not as
general as minorTicksFunction
because you don't have access to
the bounds but it can be useful when you know exactly what ticks
you want to add or modify existing tick positions.
linearMajorTicks :: (RealFrac n, Floating n) => n -> (n, n) -> [n] Source #
Ticks whose value ends in 1, 0.5, 0.25, 0.2 (*10^n).