View Source Luminous.Query.DataSet (luminous v0.9.1)

A DataSet essentially wraps a list of 1-d or 2-d data points that has a label and a type (for visualization).

Link to this section Summary

Functions

Extract and return the first value out of rows.

Override the dataset's unit with the provided string only if it's not already present.

Calculate and return the basic statistics of the dataset in one pass (loop).

Link to this section Types

@type row() :: %{y: value()} | %{x: any(), y: value()}
@type t() :: %Luminous.Query.DataSet{
  attrs: Luminous.Query.Attributes.t(),
  label: binary(),
  rows: [row()]
}
@type type() :: :line | :bar
@type value() :: Decimal.t() | binary()

Link to this section Functions

@spec first_value(t()) :: nil | any()

Extract and return the first value out of rows.

Link to this function

maybe_override_unit(dataset, unit)

View Source
@spec maybe_override_unit(t(), binary()) :: t()

Override the dataset's unit with the provided string only if it's not already present.

Link to this function

new(rows, label, attrs \\ nil)

View Source
@spec new([row()], atom() | binary(), Luminous.Query.Attributes.t() | nil) :: t()
@spec statistics(t()) :: %{
  label: binary(),
  min: any(),
  max: any(),
  n: non_neg_integer(),
  sum: Decimal.t() | nil,
  avg: Decimal.t() | nil
}

Calculate and return the basic statistics of the dataset in one pass (loop).