Contex.TimeScale (ContEx v0.4.0) View Source

A time scale to map date and time data to a plotting coordinate system.

Almost identical Contex.ContinuousLinearScale in terms of concepts and usage, except it applies to DateTime and NaiveDateTime domain data types.

TimeScale handles the complexities of calculating nice tick intervals etc for almost any time range between a few seconds and a few years.

Link to this section Summary

Functions

Define the data domain for the scale from a list of data.

Define the data domain for the scale

Specifies the number of intervals the scale should display.

Creates a new TimeScale struct with basic defaults set

Link to this section Types

Specs

datetimes() :: NaiveDateTime.t() | DateTime.t()

Specs

t() :: %Contex.TimeScale{
  custom_tick_formatter: term(),
  display_format: term(),
  domain: term(),
  interval_count: term(),
  nice_domain: term(),
  range: term(),
  tick_interval: term()
}

Link to this section Functions

Specs

domain(t(), [datetimes()]) :: t()

Define the data domain for the scale from a list of data.

Extents will be calculated by the scale.

Specs

domain(t(), datetimes(), datetimes()) :: t()

Define the data domain for the scale

Link to this function

interval_count(scale, interval_count)

View Source

Specs

interval_count(t(), integer()) :: t()

Specifies the number of intervals the scale should display.

Default is 10.

Specs

new() :: t()

Creates a new TimeScale struct with basic defaults set