View Source Terrestrial.Coordinates (terrestrial v0.1.0)

Summary

Types

  • data_min is the lowest value of your data
  • data_max is the highest value of your data
  • min is the lowest value of your axis
  • max is the highest value of your axis

used to translate cartesian coordinates into SVG ones and back

Types

anchor()

@type anchor() :: :start | :middle | :end

axis()

@type axis() :: %{
  length: float(),
  data_min: float(),
  data_max: float(),
  min: float(),
  max: float()
}
  • data_min is the lowest value of your data
  • data_max is the highest value of your data
  • min is the lowest value of your axis
  • max is the highest value of your axis

plane()

@type plane() :: %{x: axis(), y: axis()}

used to translate cartesian coordinates into SVG ones and back

point()

@type point() :: %{x: float(), y: float()}

position()

@type position() :: %{x1: float(), x2: float(), y1: float(), y2: float()}

tickConfig()

@type tickConfig() :: %{
  color: String.t(),
  length: integer(),
  width: float(),
  attrs: any()
}

Functions

fold_position(data, func)

scale_cartesian_x(plane, value)

scale_cartesian_y(plane, value)

scale_svg_x(plane, value)

scale_svg_y(plane, value)

tick(plane, config, is_x, point)

@spec tick(plane(), tickConfig(), boolean(), point()) :: map()

to_svg_x(value, plane)

@spec to_svg_x(float(), plane()) :: float()

to_svg_y(value, plane)

@spec to_svg_y(float(), plane()) :: float()

x_tick(plane, tickConfig, point)

y_tick(plane, tickConfig, point)