View Source Contex.TimeScale (ContEx v0.5.0)

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

@type datetimes() :: NaiveDateTime.t() | DateTime.t()
@type 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

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

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

Extents will be calculated by the scale.

@spec domain(t(), datetimes(), datetimes()) :: t()

Define the data domain for the scale

Link to this function

interval_count(scale, interval_count)

View Source
@spec interval_count(t(), integer()) :: t()

Specifies the number of intervals the scale should display.

Default is 10.

@spec new() :: t()

Creates a new TimeScale struct with basic defaults set