Uncharted.Chart protocol (uncharted v0.2.0) View Source

Link to this section Summary

Functions

Returns a map where the keys are atoms representing color names and the values are either Strings representing hex values or Uncharted.Gradient structs that can be used to style data points in your chart with a gradient.

Returns a map containing only Uncharted.Gradient colors. This can be used in views to draw and configure gradients in different contexts.

Takes an Uncharted.chart data structure and returns a title for the chart. The title can be used for display purposes, and will also be used for accessibility in contexts such as web-based SVG charts.

Link to this section Types

Link to this section Functions

Specs

colors(Uncharted.chart()) :: %{
  required(Uncharted.color_name()) => String.t() | Uncharted.Gradient.t()
}

Returns a map where the keys are atoms representing color names and the values are either Strings representing hex values or Uncharted.Gradient structs that can be used to style data points in your chart with a gradient.

Examples

Uncharted.Chart.colors(my_chart)
%{
  blue: "#6bdee4",
  rose_gradient: %Uncharted.Gradient{
    start_color: "#642B73",
    stop_color: "#C6426E"
  }
}

Specs

gradient_colors(Uncharted.chart()) :: %{
  required(Uncharted.color_name()) => Uncharted.Gradient.t()
}

Returns a map containing only Uncharted.Gradient colors. This can be used in views to draw and configure gradients in different contexts.

Examples

  Uncharted.Chart.colors(my_chart)
  %{
    rose_gradient: %Uncharted.Gradient{
      start_color: "#642B73",
      stop_color: "#C6426E"
    },
    blue_gradient: %Uncharted.Gradient{
      start_color: "#36D1DC",
      stop_color: "#5B86E5"
    }
  }

Specs

title(Uncharted.chart()) :: String.t()

Takes an Uncharted.chart data structure and returns a title for the chart. The title can be used for display purposes, and will also be used for accessibility in contexts such as web-based SVG charts.