The majority of input data is in the form of an array, but there are cases (such as Gauges) where the input is an object. Using objects has the advantage of allowing metadata and additional configuration information. This allows for greater flexibility in the future without having to rework the scheme.
In most charts most datums can contain a css field, but that isn't possible for the base data. Other information such as "label", "source", "collection date", etc... could also be useful in the data object.
The data object should be capable of being serialized as a JSON object to avoid having code perform transformations. The only required actions by a user should be using *Prop options to map the fields for chart consumption.
Tasks
[ ] Update all charts to accept an object as the data. For data that is currently an array nest the current data under a consistent (and customizable via a *Prop option) field, for example "items". Note: "values" is the default prop in most cases for objects with nested items (line charts, grouped bar charts, ...) so use of valuesProp would create conflicts and should not be used.
[ ] Add a data accessor to allow deep (i.e. use Lodash's get() like option() uses) so that users can access their own data elements for easy use in lifecycle event callbacks.
The majority of input data is in the form of an array, but there are cases (such as Gauges) where the input is an object. Using objects has the advantage of allowing metadata and additional configuration information. This allows for greater flexibility in the future without having to rework the scheme.
In most charts most datums can contain a
css
field, but that isn't possible for the base data. Other information such as "label", "source", "collection date", etc... could also be useful in the data object.The data object should be capable of being serialized as a JSON object to avoid having code perform transformations. The only required actions by a user should be using
*Prop
options to map the fields for chart consumption.Tasks
*Prop
option) field, for example "items". Note: "values" is the default prop in most cases for objects with nested items (line charts, grouped bar charts, ...) so use ofvaluesProp
would create conflicts and should not be used.get()
likeoption()
uses) so that users can access their own data elements for easy use in lifecycle event callbacks.