Herein lies the frontend source code for the Polychart Dashboard Builder. The
directory poly/main contains the source code to UI of the Dashboard Builder.
The poly.coffee file defines the API for constructing the Dashboard Builder
and constituents; the API is as follows:
poly.dashboard:
This function consumes an object params that contains the following fields:
params.header:boolFlag indicating whether or not the header should be shown; default istrue.params.local:boolFlag that disables saving and tutorial completion server calls.params.customSaving:functionAn optional function that overrides the default saving behaviour (an HTTP request). The function is passed a serialized dashboard.params.isDemo:boolFlag to use demo data and to disable features such as saving; default isfalse.params.showTutorial:boolFlag indicating whether or not the NUX tutorial is to be shown; default isfalse.params.width:string | numparams.height:string | numEither a numerical amount indicating the pixel or percent dimensions of the dashboard builder or the stringfill.params.key:stringA unique key identifying a dashboard. Ifparams.customSaving == true, then this is optional.params.name:stringA string denoting the name of the dashboard; this will correspond to the string shown in the title field of the dashboard builder.params.dom:string | DOMEither a string corresponding to theidof theDOMon which the Dashboard Builder is to be rendered on, or theDOMelement itself.params.dataCollection:list | objectA list of JSON objects (or just one) with fieldstype,dataSourceKeyandtableNamesfor which the dataview should be populated with.params.initial:listA list of JSON objects, each of which are serialized states of the dashboard. If this list is nonempty, then the serialized items are passed into the constructor, and the dashboard will initially be populated by the deserialized versions of those objects.
poly.dashviewer:
This is a constructor for the Dashboard Viewer, an interface in which charts
may be viewed but not edited. This function consumes an object params with
the following fields, each of which have the same meaning as above:
params.name:stringparams.initial:listparams.dom:string | DOMparams.dataCollection:list
poly.chartbuilder:
Constructs only the Chartbuilder interface, and nothing more. This function
consumes an object params with the following fields, each of which has the
same meaning as above:
params.header:boolparams.isDemo:boolparams.width:string | numparams.height:string | numparams.initial:listparams.dom:string | DOMparams.dataCollection:list
poly.chartviewer:
Constructs a viewer interface for a single chart. This function consumes an
object params with the following fields, each of which have the same meaning
as above:
params.width:string | numparams.height:string | numparams.initial:listparams.dom:string | DOMparams.dataCollection:list
poly.data:
A function to construct a Polychart data source. This takes an object args
with the following fields:
args.type:stringThis denotes the type of data source to be constructed. This can belocalorremote.args.tables:listA list of tables---the data.args.customBackend:boolA flag indicating whether or not a custom backend is to be used; that is, one which denotes whether or not the Polychart backend is used.args.dataSourceKey:stringA unique identifier for a backend data source.