Chart-1.9.3: A library for generating 2D Charts and Plots
Copyright(c) Tim Docker 2010 2014
LicenseBSD-style (see chart/COPYRIGHT)
Safe HaskellNone
LanguageHaskell98

Graphics.Rendering.Chart.Axis.Time

Description

Calculate and render time axes

Synopsis

Documentation

type TimeSeq = UTCTime -> ([UTCTime], [UTCTime]) Source #

TimeSeq is a (potentially infinite) set of times. When passed 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.

type TimeLabelFn = UTCTime -> String Source #

How to display a time

data TimeLabelAlignment Source #

Constructors

UnderTicks 
BetweenTicks 

Instances

Instances details
Show TimeLabelAlignment Source # 
Instance details

Defined in Graphics.Rendering.Chart.Axis.Time

Methods

showsPrec :: Int -> TimeLabelAlignment -> ShowS

show :: TimeLabelAlignment -> String

showList :: [TimeLabelAlignment] -> ShowS

class TimeValue t where Source #

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

Minimal complete definition

utctimeFromTV, tvFromUTCTime

Methods

utctimeFromTV :: t -> UTCTime Source #

tvFromUTCTime :: UTCTime -> t Source #

doubleFromTimeValue :: t -> Double Source #

timeValueFromDouble :: Double -> t Source #

Instances

Instances details
TimeValue Day Source # 
Instance details

Defined in Graphics.Rendering.Chart.Axis.Time

Methods

utctimeFromTV :: Day -> UTCTime Source #

tvFromUTCTime :: UTCTime -> Day Source #

doubleFromTimeValue :: Day -> Double Source #

timeValueFromDouble :: Double -> Day Source #

TimeValue UTCTime Source # 
Instance details

Defined in Graphics.Rendering.Chart.Axis.Time

Methods

utctimeFromTV :: UTCTime -> UTCTime Source #

tvFromUTCTime :: UTCTime -> UTCTime Source #

doubleFromTimeValue :: UTCTime -> Double Source #

timeValueFromDouble :: Double -> UTCTime Source #

TimeValue LocalTime Source # 
Instance details

Defined in Graphics.Rendering.Chart.Axis.Time

Methods

utctimeFromTV :: LocalTime -> UTCTime Source #

tvFromUTCTime :: UTCTime -> LocalTime Source #

doubleFromTimeValue :: LocalTime -> Double Source #

timeValueFromDouble :: Double -> LocalTime Source #

timeValueAxis Source #

Arguments

:: TimeValue t 
=> TimeSeq

Set the minor ticks, and the final range will be aligned to its elements.

-> TimeSeq

Set the labels and grid.

-> TimeLabelFn 
-> TimeLabelAlignment 
-> TimeSeq

Set the second line of labels.

-> TimeLabelFn

Format t for labels.

-> TimeLabelAlignment 
-> AxisFn t 

Create an AxisFn to for a time axis.

The values to be plotted against this axis can be created with doubleFromLocalTime.

Implementation detail: PlotValue constraint is needed to use vmap.

autoTimeValueAxis :: TimeValue t => AxisFn t Source #

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 doubleFromTimeValue.

days :: TimeSeq Source #

A TimeSeq for calendar days.

months :: TimeSeq Source #

A TimeSeq for calendar months.

years :: TimeSeq Source #

A TimeSeq for calendar years.

Orphan instances

PlotValue Day Source # 
Instance details

Methods

toValue :: Day -> Double Source #

fromValue :: Double -> Day Source #

autoAxis :: AxisFn Day Source #

PlotValue UTCTime Source # 
Instance details

Methods

toValue :: UTCTime -> Double Source #

fromValue :: Double -> UTCTime Source #

autoAxis :: AxisFn UTCTime Source #

PlotValue LocalTime Source # 
Instance details

Methods

toValue :: LocalTime -> Double Source #

fromValue :: Double -> LocalTime Source #

autoAxis :: AxisFn LocalTime Source #