Mix.install([
  {:kino, "~> 0.19"},
  {:echarts, path: Path.expand("..", __DIR__)}
])

Code.require_file(Path.join(__DIR__, "support/chart_gallery.ex"))

# Match Livebook's default light canvas; Tema can switch to dark.
render_chart = fn name -> ChartGallery.kino(name, theme: :light) end

Sobre

Every built-in ECharts 2D and 3D/GL chart family, rendered one cell at a time. The setup cell installs the package from this checkout and loads the fixtures.

Tema

Run this cell once. Choose Claro or Escuro, then re-evaluate a chart cell. Each chart is independent, so you can compare both themes side by side.

theme_input =
  Kino.Input.select("Tema", [{"light", "Claro"}, {"dark", "Escuro"}], default: "light")

render_chart = fn name ->
  ChartGallery.kino(name, theme: Kino.Input.read(theme_input))
end

theme_input

Index

ChartGallery.charts()
|> Enum.map(fn chart ->
  %{"category" => chart.category, "chart" => chart.name, "height" => chart.height}
end)
|> Kino.DataTable.new()

Line

Cartesian — Smooth line with an area fill.

render_chart.("Line")

Bar

Cartesian — Grouped bars with rounded tops.

render_chart.("Bar")

Scatter

Cartesian — Two-dimensional points.

render_chart.("Scatter")

Effect scatter

Cartesian — Scatter with a ripple effect.

render_chart.("Effect scatter")

Heatmap

Cartesian — Matrix of values on two category axes.

render_chart.("Heatmap")

Pictorial bar

Cartesian — Bars drawn with repeated symbols.

render_chart.("Pictorial bar")

Lines

Cartesian — Trajectories on a cartesian plane.

render_chart.("Lines")

Theme river

Cartesian — Stacked streams over time.

render_chart.("Theme river")

Candlestick

Financial — OHLC candles with a moving average.

render_chart.("Candlestick")

Boxplot

Financial — Distribution summaries for four groups.

render_chart.("Boxplot")

Calendar heatmap

Financial — Daily values on a calendar.

render_chart.("Calendar heatmap")

Pie

Circular — Donut chart with a legend.

render_chart.("Pie")

Radar

Circular — Multivariate comparison.

render_chart.("Radar")

Gauge

Circular — Single-value gauge.

render_chart.("Gauge")

Funnel

Circular — Conversion funnel.

render_chart.("Funnel")

Chord

Circular — Directed flows between categories.

render_chart.("Chord")

Tree

Hierarchy and flow — Collapsible tree with curved edges.

render_chart.("Tree")

Treemap

Hierarchy and flow — Nested rectangles sized by value.

render_chart.("Treemap")

Sunburst

Hierarchy and flow — Radial hierarchy.

render_chart.("Sunburst")

Graph

Hierarchy and flow — Force-directed network.

render_chart.("Graph")

Sankey

Hierarchy and flow — Weighted flows between nodes.

render_chart.("Sankey")

Parallel

Hierarchy and flow — Parallel coordinates for several rows.

render_chart.("Parallel")

Map

Geo and matrix — GeoJSON map registered at runtime.

render_chart.("Map")

Matrix

Geo and matrix — ECharts 6 matrix coordinate system.

render_chart.("Matrix")

3D bar

3D — Bars on a WebGL grid, powered by echarts-gl.

render_chart.("3D bar")

3D scatter

3D — WebGL points in a three-dimensional grid.

render_chart.("3D scatter")

3D line

3D — A polyline traced through a 3D grid.

render_chart.("3D line")

3D surface

3D — A parametric surface rendered with echarts-gl.

render_chart.("3D surface")

Globe

3D — A WebGL globe with 3D scatter points.

render_chart.("Globe")

3D map

3D — GeoJSON regions extruded by the WebGL renderer.

render_chart.("3D map")

3D lines

3D — Flight-style trajectories over a 3D map.

render_chart.("3D lines")

3D polygons

3D — Polygon regions drawn on the 3D geo coordinate system.

render_chart.("3D polygons")

Scatter GL

3D — Large point cloud rendered on the GPU.

render_chart.("Scatter GL")

Graph GL

3D — Force-directed network rendered with WebGL.

render_chart.("Graph GL")

Lines GL

3D — GPU-rendered polylines on a geo coordinate system.

render_chart.("Lines GL")

Flow GL

3D — Vector field on a cartesian plane.

render_chart.("Flow GL")

Word cloud

Extensions — Weighted words laid out by echarts-wordcloud.

render_chart.("Word cloud")

Liquid fill

Extensions — Animated liquid gauge from echarts-liquidfill.

render_chart.("Liquid fill")

Custom

Extensibility — Custom series rendered by a JavaScript callback.

render_chart.("Custom")

Notes

  • All built-in 2D series are covered: line, bar, pie, scatter, effectScatter, radar, candlestick, boxplot, heatmap, map, tree, treemap, sunburst, graph, gauge, funnel, parallel, sankey, pictorialBar, themeRiver, lines, calendar, chord, matrix and custom.
  • All echarts-gl chart types are covered: bar3D, scatter3D, line3D, surface, globe, map3D, lines3D, polygons3D, scatterGL, graphGL and flowGL.
  • custom series use the :functions option; the option stores a %{"$function" => "name"} marker and the client compiles the JavaScript.
  • 3D charts set gl: true; the client then loads the bundled echarts-gl extension only when needed.
  • Each chart is its own cell, so a failure in one example does not take down the rest of the gallery.