# `ECharts.Phoenix`
[🔗](https://github.com/Mateus-M-Reis/echarts/blob/main/lib/echarts/phoenix.ex#L2)

Helpers for Phoenix LiveView.

See `ECharts.Phoenix.Component` for rendering and hook setup.

# `push_update`

```elixir
@spec push_update(
  Phoenix.LiveView.Socket.t(),
  String.t(),
  ECharts.Chart.t() | ECharts.option()
) ::
  Phoenix.LiveView.Socket.t()
```

Pushes a chart update to a LiveView without going through the DOM differ.

The chart container must have the same `id` used here. The hook handles
the `"echarts:update"` event and re-renders only matching containers.

    def handle_event("refresh", _params, socket) do
      chart = build_chart()
      {:noreply, ECharts.Phoenix.push_update(socket, "sales", chart)}
    end

This is the recommended path for large series, where serializing the
option into a data attribute on every render would produce a large diff.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
