The function component of Fude: <.chart>.
import Fude.Components
<.chart id="revenue" chart={Fude.bar(@sales, x: :region, y: :revenue)} />A saved spec draws with its data given again:
<.chart id="revenue" spec={@report.chart} data={@sales} />The chart needs the Fude hook in the LiveSocket and the Fude CSS (see
the README). The server writes the chart's title, its words, a single
number (Fude.number/2) and a table of the data; the hook draws the
plot, and draws it again in place when the chart or its data change,
moving its marks to their new places.
Before the hook mounts (and with JavaScript off), the chart is its words and its table.
A chart that cannot draw (a field that is not in the data, a spec that is not valid) shows why, in place of the plot, and does not raise.
Summary
Functions
Renders a chart.
Functions
Renders a chart.
Give it a chart (chart, from the functions of Fude), or a spec
(spec, from Fude.Spec.dump/1) with its data (data).
Attributes
id(:string) (required) - the id of the chart, unique on the page.chart(Fude.Chart) - the chart, from the functions ofFude. Defaults tonil.spec(:map) - a spec of the chart (Fude.Spec.dump/1), withdata. Defaults tonil.data(:any) - the chart's data, for a spec or a chart made without it; a map of names for a chart of several. Defaults tonil.height(:integer) - the height of the plot in pixels; the chart's own, or 320. Defaults tonil.locale(:string) - the locale that writes numbers and dates; the browser's unless given. Defaults tonil.table(:boolean) - whether the data table is on the page (under a toggle). Defaults totrue.export(:boolean) - whether the chart has buttons that save it as SVG and PNG (see alsoFude.Live.export/3). Defaults tofalse.issho(:string) - the Issho document of a shared chart (Fude.Issho): the people of its room see each other's pointers on its marks. Defaults tonil.class(:any) - classes for the chart's element. Defaults tonil.- Global attributes are accepted.