Search
DataSource Class
Remarks See Also
 






A base class for dashboard data sources.

Namespace: MindFusion.Dashboards
File: DataSource.js

 Syntax

JavaScript  Copy Code

// class
DataSource.prototype = {}

 Remarks

DataSource is the abstract foundation of MindFusion.Dashboards' decoupled data architecture. It isolates UI widgets from backend data retrieval logic. Widgets declare the data source ID and property path they require, and the DataSource handles fetching, caching, transformation, and change notification.

Every dashboard manages a dataSources collection, which is an instance of DataSourceRegistry. Data sources are registered by assigning a unique string key:

JavaScript  Copy Code

dashboard.dataSources.add(new StaticDataSource("sales-data", localData));

MindFusion provides three concrete data source implementations:

1. StaticDataSource: Holds in-memory JavaScript objects, arrays, or JSON payloads.
2. ServiceDataSource: Fetches JSON data asynchronously from remote HTTP/REST endpoints, with optional automated interval polling (refreshInterval).
3. MockDataSource: Procedurally generates synthetic data (numbers, dates, currency, trends, series) for rapid prototyping and design-time wireframing.

When new data arrives or a source updates, calling refresh() fires the onDataChanged event. The parent Dashboard intercepts this event and automatically triggers an invalidation pass on every widget bound to that data source.

 Inheritance Hierarchy

 See Also