A collection as a Fude chart: a view's records grouped and counted, or summed, in the database, and drawn by Fude.
<Cardbox.Fude.chart id="budget" cardbox={MyApp.Cardbox} collection={@collection} view={@view} />The view is a saved Cardbox.View of type chart, whose options say
what it draws:
kind-bar,line,area,pie,donutornumber;x- the field of the groups (not for anumber): a select, a status, a person, a checkbox, a text, a number or a date;unit- for a date,day,monthoryear;y-count(the default), or%{"sum" => field}(ormean,min,max) of a number field;color- a second field, whose groups are the bars' colours or the lines;title- the chart's title, the view's name unless given.Box.save_view(projects, %{ name: "Budget by status", type: "chart", options: %{kind: "bar", x: "Status", y: %{sum: "Budget"}, color: "Priority"} })
One GROUP BY through the view's query reads the groups, not the
records: a chart of fifty thousand records reads a few rows. Choices
are in their order, as a board shows them, and a currency number is
formatted in its currency.
Summary
Functions
The Fude.Chart of a chart view, its data read from the database.
opts: :people (%{id, name}, for a person's groups), and those of
a query (:me, :time_zone, :now).
A chart of a view's records.
Functions
@spec build(module(), Cardbox.Collection.t(), Cardbox.View.t(), keyword()) :: {:ok, Fude.Chart.t()} | {:error, Cardbox.Error.t()}
The Fude.Chart of a chart view, its data read from the database.
opts: :people (%{id, name}, for a person's groups), and those of
a query (:me, :time_zone, :now).
A chart of a view's records.
Attributes
id(:string) (required)cardbox(:atom) (required) - your Cardbox module.collection(Cardbox.Collection) (required)view(Cardbox.View) (required) - a view of typechart.people(:list) -%{id, name}, for a person field's groups. Defaults to[].me(:any) - Defaults tonil.time_zone(:string) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["height", "locale", "table", "export", "class"].