Helpers for Phoenix LiveView.
See ECharts.Phoenix.Component for rendering and hook setup.
Summary
Functions
Pushes a chart update to a LiveView without going through the DOM differ.
Functions
@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)}
endThis is the recommended path for large series, where serializing the option into a data attribute on every render would produce a large diff.