Dashboard custom element
Embed a dashboard with gd-dashboard, configure its workspace, locale, and read-only mode, and subscribe to dashboard events.
gd-dashboard is the legacy dashboard element, kept for existing integrations. For new integrations, use gd-dashboard-embed, which adds JavaScript properties, the refresh() and replaceFilters() methods, dashboard plugin loading, and the gd-ready and gd-error events. See Dashboard and visualization embed elements.gd-dashboard embeds a GoodData dashboard. It renders the Dashboard component:
<!-- minimal setup -->
<gd-dashboard dashboard="my-dashboard-id"></gd-dashboard>
Supported attributes
<!-- all supported attributes -->
<gd-dashboard
dashboard="my-dashboard-id"
workspace="my-workspace-id"
locale="en-US"
readonly
mapbox="my-mapbox-token"
agGrid="my-ag-grid-license-key"
></gd-dashboard>
dashboard- required, the ID of the dashboard to embed.workspace- optional, the ID of the workspace for this dashboard. By default, it’s taken from the context, for example from the script URL.locale- optional, defaults toen-US. The localization of the dashboard UI. Use the hyphenated form (en-US,de-DE); an unknown value falls back toen-US. For all available languages, see the full list of available localizations.readonly- optional. If enabled, the dashboard is embedded in read-only mode and all user interaction that would alter any backend state is disabled (for example, creating or changing alerts and scheduled emails).mapbox- optional, a Mapbox access token used by geo charts on the dashboard. Overrides themapboxTokenfrom the context.agGrid- optional, an AG Grid license key used by pivot tables on the dashboard. Overrides theagGridTokenfrom the context.
You can also set the workspace ID once on the context instead of passing it to every element. See the code example in Web Components authentication.
Supported events
gd-dashboard forwards every event the Dashboard component emits as a DOM event named after the event type (see DashboardEventType), for example GDC.DASH/EVT.INITIALIZED.
Events don’t bubble and aren’t cancelable. Subscribe to them as to any other DOM event:
<gd-dashboard dashboard="my-dashboard-id" id="some-dom-id"></gd-dashboard>
<script>
const dashboardEl = document.getElementById("some-dom-id");
dashboardEl.addEventListener("GDC.DASH/EVT.INITIALIZED", (event) => {
// See what's in the event payload
console.log(event.detail);
});
</script>
Related
Embed a dashboard or a saved visualization with gd-dashboard-embed and gd-insight-embed, and drive them through properties, methods, and events.
Understand what the Web Components library is, when to choose it over an iframe or the React library, how it loads, and what limits it has.
Authenticate Web Components against GoodData using the auth=sso script parameter for automatic SSO or setContext for a programmatic flow.
Embed a saved dashboard with Dashboard, read its state through selectors, dispatch commands, handle events, configure behavior, and access its store externally.
Embed a saved visualization with the legacy gd-insight element, set its workspace, locale, title, filters, and size, and subscribe to its events.