!typed according to previous comments - but I was using it in a way that was working and doesn't match the comments... each entry in dataSources will contain dataStore - the actual dataStore object (previously this comment erroneously referred to as 'dataSource') name - the name given to this data source menuBar the dom menu associated with this element contentDiv the div that the charts associated with the datastore will be added
other data store
information about what properties to target in ods
For instance, { source_column: <column_name>, target_chart: <chart_id>, target_property: <property_name> }
more concretely: { source_column: "feature", target_chart: "quadrat_image_chart", target_property: "color_by" }
Adds a link that will filter a column in one datasource based on the values in another: when the values in the source column are filtered, the values in the destination column will be filtered so that only those appearing in the selected values of the source column will be displayed.
Adds a chart to the app. Returns asyncronously when needed columns have loaded and the chart has been added (will reject if there is an error)
The name of the chart's data source
The chart's config
Optional
notify: boolean = falseIf true any listeners will be informed that a chart has been loaded
Adds a listener to the ChartManager.
Note that the signature is different from what might be expected (this is an MDV pattern that may be reviewed in future):
The first argument is a string that identifies the listener (not an event type to listen for).
Subsequent calls to addListener with the same id will overwrite the previous listener (which could lead to
unexpected behaviour, for example if a corresponding removeListener()
call is made).
The second argument is a function that will be called when the listener is triggered - all registered listeners will be called
for any event.
Callback function.
First argument is the type of event ("state_saved" | "view_loaded" | "chart_added" | "chart_removed"
),
second is the ChartManager
instance, third is the data.
Adds a menu icon to either the main menubar or a datasource menubar
The name of data source or _main if adding an icon to the main (top) toolbar
The class name(s) of the icon
Text that will be displayed in a tooltip
The function that will be called when the icon is pressed
If true (and dataSource = "_main"
) the icon will be added to the right of the menu bar
Loads data for specified columns into the appropriate dataStore
An array of column fields/ids
The name of the dataSource
A function which will be run once all the columns are loaded, with any failed columns as an argument (although it's not clear that the underlying code actually does this, or that any code that calls this function actually uses the argument)
Optional
split: number = 10the number of columns to send with each request
Optional
threads: number = 2the number of concurrent requests
Loads data from a remote file -the file must have headers (keys in the case of json) which which match a columns field/id
A config describing the file -
the name of the datasource to load the data into
either csv,tsv ot json
the url of the file
Optional
callback: Functiona function to run once the data has loaded
The object to manage charts Chart Manager
Param: div
The DOM element or id of the element to house the app
Param: datasources
An array of datasource configs - see Data Source. Each config must contain the size parameter, giving the number of rows in the DataStore.
Param: dataloader
An object containing the following
Param: config
extra settings
Param: config.initialCharts
A list of chart configs to initially load if no views are specified
Param: config.all_views
A list of views that can be loaded (a suitable view loader is required to atually load the view)
Param: config.current_view
the current view (only used with all views)
Param: config.permisson
the level of permission the user has. This just makes certain options unavaliable. Any logic should be handled when a state_saved event is broadcast
Param: config.gridstack
whether to arrange the charts in a grid
Param: listener
A function to listen to events.
(eventType: string, cm: ChartManager, data: any) => void | Promise<void>
beware: the way 'event listeners' are implemented is highly unorthodox and may be confusing.