React Embedded AnalyticsSharing Data

If data sources are shared between multiple instances of Studio, or it's desirable to cache data whilst the Studio component is destroyed/recreated, a Data Engine can be used.

The Data Engine handles the loading, processing and caching of data. When providing data sources to Studio, it automatically creates a Data Engine. The Data Engine can instead be created outside of Studio by using the createDataEngine(data) function and passing the data source definitions. The Data Engine can then be passed to the data property of Studio.

const dataEngine = createDataEngine({
    sources: [{
        id: 'medals',
        data: [
            {
                year: 2000,
                sport: 'Swimming',
                country: 'United States',
                // ... other fields
            },
            // ... other rows
        ],
    }],
});
const data = useMemo(() => { 
	return dataEngine;
}, []);

<AgStudio data={data} />

createDataEngine(data) accepts a data object of type AgDataSourcesDefinition.

sourcesCopy Link
AgDataSource<TFormats>[]
One or more data sources.
relationshipsCopy Link
AgRelationDefinition[]
When using multiple related tables, this describes the fields that link the tables together.
expressionsCopy Link
AgExpressionFieldDefinition<TExpressionOperatorTypes, any, TFormats>[]
Expression field definitions for calculated columns.
formatsCopy Link
TFormats
Overrides to existing formats, or additional custom formats.