Giggly.Scale.Secondary (giggly v0.2.0)

Copy Markdown View Source

A position scale's secondary axis, drawn opposite its axis. Giggly.Plot's position scale functions record one from their sec_axis: option in the scale's secondary field, which is :none for a scale without one. Its fields:

  • transform: the function of one value that turns each of the axis's values, in data units, into the secondary axis's, strictly increasing or decreasing over the data; on a date, date-time or time axis a shift, handed and returning a value of the column's type; on a discrete axis the identity.
  • name: the secondary axis's title, :none for none, or :derive for the axis's own.
  • breaks: the values the secondary axis marks, in its own units: a list, a function handed its extent, {low, high}, that returns them, :none for none, :default for those its axis's transformation chooses, or :derive for the axis's own breaks, read in the secondary axis's units.
  • labels: the breaks' labels, as the axis's labels takes them, or :derive for the axis's own.
  • guide: the guide that draws it: :default, an axis beside the panel; :axis, :none, or an axis {:axis, options} makes (%Giggly.Guide.Axis{}), as the axis's guide takes them; or :derive for the axis's own. Giggly.Plot.guides/2's x_sec: and y_sec: set one over it.

Summary

Types

t()

@type t() :: %Giggly.Scale.Secondary{
  breaks: :default | :derive | :none | list() | ({term(), term()} -> list()),
  guide: :default | :derive | :axis | :none | struct(),
  labels:
    :default
    | :derive
    | :none
    | [String.t() | nil]
    | map()
    | (list() -> [Scales.Labels.power_label()]),
  name: :none | :derive | String.t(),
  transform: (term() -> term())
}