# ECharts demo

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

## Sobre

A minimal Livebook notebook that installs `echarts` from this checkout. Run
`livebook server examples` from the repository root, or open this file in
Livebook directly.

For every supported chart family, open [gallery.livemd](gallery.livemd).

## Line chart

```elixir
option = %{
  tooltip: %{trigger: "axis"},
  grid: %{left: 56, right: 24, top: 32, bottom: 40},
  xAxis: %{type: "category", data: ["Seg", "Ter", "Qua", "Qui", "Sex"]},
  yAxis: %{type: "value", scale: true},
  series: [
    %{
      name: "Preço",
      type: "line",
      smooth: true,
      showSymbol: false,
      data: [101.2, 103.8, 102.4, 106.1, 108.7],
      lineStyle: %{width: 2, color: "#38bdf8"},
      areaStyle: %{color: "rgba(56,189,248,0.14)"}
    }
  ]
}

ECharts.Kino.new(option, height: 360, theme: :light)
```

## Candlestick

```elixir
candles = [
  %{t: "2026-11-24", o: 100.0, h: 106.0, l: 98.0, c: 104.0},
  %{t: "2026-11-25", o: 104.0, h: 109.0, l: 102.0, c: 107.0},
  %{t: "2026-11-26", o: 107.0, h: 108.0, l: 99.0, c: 101.0}
]

candlestick = %{
  tooltip: %{trigger: "axis"},
  xAxis: %{type: "category", data: Enum.map(candles, & &1.t)},
  yAxis: %{type: "value", scale: true},
  dataZoom: [%{type: "inside", start: 0, end: 100}],
  series: [
    %{
      type: "candlestick",
      data: Enum.map(candles, &[&1.o, &1.c, &1.l, &1.h])
    }
  ]
}

ECharts.Kino.new(candlestick, height: 360, theme: :light)
```
