JavaScript Embedded AnalyticsSynchronous Data Sources

Synchronous data sources can be used when data has already been loaded in the application.

A synchronous data source represents a single table of data.

const studioProperties = {
    data: {
        sources: [{
            id: 'medals',
            data: [
                {
                    year: 2000,
                    sport: 'Swimming',
                    country: 'United States',
                    // ... other fields
                },
                // ... other rows
            ],
        }],
    },

    // other studio properties ...
}

Synchronous data sources are represented by the AgSimpleDataSourceDefinition interface.

TData[]
Row data.
fieldsCopy Link
AgFieldDefinition<any, any, TFormats>[]
Fields in the table. If not provided, will be inferred from the data.
string
Table ID
string
Table display name. If not provided, a formatted version of id will be used.

Fields Copy Link

By default, if no fields are provided, they will be inferred from the data.

It is also possible to provide and customise fields as part of the source definition.

The example above demonstrates customising fields. The country field has been titled Location, and the age field has been hidden from the UI.

formatCopy Link
TFormat
The format type of the field (provides default formatting, etc.).
accessorCopy Link
AgFieldDataAccessor<TData, InferDataTypeFromFormat<TFormat, TFormats>>
Optional. How to retrieve the value from the data. Either the property key, or a callback. If undefined, id will be used as the property key.
cardinalityCopy Link
AgFieldCardinality
Optional. Cardinality of the field data. Improves performance if provided.
notBlankCopy Link
boolean
Optional. Does the field contain blank values. Improves performance if provided.
string
Field ID.
string
Display name.
descriptionCopy Link
string
Field description. Displayed in the Field Panel
boolean
Set to true to hide from being selected in the UI. Field can still be used for joins.
serializerCopy Link
AgFieldSerializer<InferDataTypeFromFormat<TFormat, TFormats>>
Optional. How the field values will be serialized into state. Defaults to format serializer.
deserializerCopy Link
AgFieldDeserializer<InferDataTypeFromFormat<TFormat, TFormats>>
Optional. How the field values will be deserialized from state. Defaults to format deserializer.
valueFormatterCopy Link
AgFieldValueFormatter<InferDataTypeFromFormat<TFormat, TFormats>, TOptions>
Optional. How the field values will be displayed. Defaults to format value formatter.
blankValueCopy Link
string
Optional. How blank values will be displayed. Defaults to format blank value.
optionsCopy Link
TOptions
Optional. Will be passed to the value formatter.

Multiple Tables Copy Link

When multiple tables are provided, they can be linked by providing Relationships.

Reloading Data Copy Link

Synchronous data can be reloaded by passing updated data sources to the data property.

Note that only the data will be updated. Data sources cannot be added or removed, and fields cannot be updated.