MindFusion.Dashboards features a decoupled data-binding architecture that isolates widgets from backend data retrieval. Widgets declare data source keys and field paths, while the dashboard's DataSourceRegistry handles fetching, caching, and distribution.

DataSource and DataSourceRegistry
Every dashboard maintains a dataSources collection (an instance of DataSourceRegistry). Data sources are registered by assigning a unique string identifier.
JavaScript
Copy Code
|
|---|
// Registering a data source with the dashboard var dataSource = new MindFusion.Dashboards.StaticDataSource("sales-data"); dashboard.dataSources.add(dataSource); |
Supported Data Source Kinds
MindFusion.Dashboards provides three specialized data source implementations:
1. StaticDataSource: Wraps local, in-memory JavaScript objects, arrays, or pre-loaded JSON structures.
JavaScript
Copy Code
|
|---|
var staticData = new MindFusion.Dashboards.StaticDataSource("portfolio-source"); staticData.data = { metrics: { totalRaised: "$48.2M", dealsCount: 14 }, investments: [ { company: "BioGen AI", stage: "Series A", amount: 12000000 }, { company: "QuantumCore", stage: "Seed", amount: 3500000 } ] }; dashboard.dataSources.add(staticData); |
2. ServiceDataSource: Connects to remote REST APIs, microservices, or database endpoints via HTTP/HTTPS.
JavaScript
Copy Code
|
|---|
var serviceData = new MindFusion.Dashboards.ServiceDataSource("live-feed", { url: "https://api.example.com/v1/metrics", refreshInterval: 5000 // Poll every 5 seconds for live telemetry }); dashboard.dataSources.add(serviceData); |
3. MockDataSource: Generates realistic synthetic datasets for development, wireframing, and offline demonstrations.
Binding Widgets to Data (dataPath and valuePath)
Widgets connect to a registered data source using string binding paths:
- dataSource: The string identifier matching a registered DataSource in the DataSourceRegistry.
- dataPath: The property path, optionally navigating to a nested object or array within the data source (supports dot-notation, e.g. "sales.q3").
- changePath: The field name containing delta or growth percentages (used by KpiWidget).
- labelPath: The field name containing data point labels or category titles.
JavaScript
Copy Code
|
|---|
// Example: Binding a KPI card to a nested metric var kpi = new MindFusion.Dashboards.KpiWidget(); kpi.dataSource = "portfolio-source"; kpi.dataPath = "metrics.totalRaised"; kpi.headerText = "Total Funding"; |
Chart Data Binding with DashboardSeries
For charts requiring multi-series or multi-dimensional data, the ChartWidget uses an array of DashboardSeries configurations:
JavaScript
Copy Code
|
|---|
var chart = new MindFusion.Dashboards.ChartWidget(); chart.chartType = MindFusion.Dashboards.ChartType.Line; chart.dataSource = "sales-data"; chart.series = [ { name: "Current Year", dataPath: "revenue.monthly", valuePath: "actual", labelPath: "month" }, { name: "Forecast Target", dataPath: "revenue.monthly", valuePath: "target", labelPath: "month" } ]; |
Specialized Financial & 3D Paths
For financial Candlestick charts and Bubble charts, DashboardSeries supports specialized dimension paths:
- openPath: Starting price of the trading period.
- closePath: Ending price of the trading period.
- highPath: Highest price reached during the period.
- lowPath: Lowest price reached during the period.
- radiusPath: Value determining bubble radius (for Bubble charts).
Refreshing Data Sources
When underlying data changes, calling the refresh method on the data source updates all dependent widgets automatically:
JavaScript
Copy Code
|
|---|
dataSource.refresh(); |