Kino.VegaLite (Kino v0.1.0) View Source

A widget wrapping VegaLite graphic.

This widget allow for rendering regular VegaLite graphic and then streaming new data points to update the graphic.

Examples

vl_widget =
  Vl.new(width: 400, height: 400)
  |> Vl.mark(:line)
  |> Vl.encode_field(:x, "x", type: :quantitative)
  |> Vl.encode_field(:y, "y", type: :quantitative)
  |> Kino.VegaLite.start()
  |> Kino.render()

for i <- 1..300 do
  point = %{x: i / 10, y: :math.sin(i / 10)}
  Kino.VegaLite.push(vl_widget, point)
  Process.sleep(25)
end

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Removes all data points from the graphic dataset.

Appends a single data point to the graphic dataset.

Appends a number of data points to the graphic dataset.

Starts a widget process with the given VegaLite definition.

Link to this section Types

Specs

t() :: %Kino.VegaLite{pid: pid()}

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

clear(widget, opts \\ [])

View Source

Specs

clear(Kino.Widget.t(), keyword()) :: :ok

Removes all data points from the graphic dataset.

Options

  • dataset - name of the targetted dataset from the VegaLite specification. Defaults to the default anonymous dataset.
Link to this function

push(widget, data_point, opts \\ [])

View Source

Specs

push(Kino.Widget.t(), map(), keyword()) :: :ok

Appends a single data point to the graphic dataset.

Options

  • :window - the maximum number of data points to keep. This option is useful when you are appending new data points to the plot over a long period of time.

  • dataset - name of the targetted dataset from the VegaLite specification. Defaults to the default anonymous dataset.

Link to this function

push_many(widget, data, opts \\ [])

View Source

Specs

push_many(Kino.Widget.t(), [map()], keyword()) :: :ok

Appends a number of data points to the graphic dataset.

See push/3 for more details.

Specs

start(VegaLite.t()) :: t()

Starts a widget process with the given VegaLite definition.