Embedded Dashboard Methods
This section addresses the embedded dashboards and reports that are part of the Pixel-perfect interface (see GoodData Portal).
For embedded Analytical Designer and KPI Dashboards, see Embed Analytical Designer and Embed a KPI Dashboard.
Print a dashboard tab
Description: Prints the current dashboard tab.
{
gdc: {
name: 'tab.print'
}
}
Edit a dashboard
Description: Switches the dashboard to edit mode.
{
gdc: {
name: 'dashboard.edit'
}
}
Email a dashboard
Description: Schedules an automatic email with a dashboard in the attachment. This is identical to scheduling an email directly via the GoodData Portal (see Schedule Automatic Emailing of Dashboards to Yourself and Others).
{
gdc: {
name: 'dashboard.schedule'
}
}
Apply attribute and date filters to a dashboard
Description: Applies the attribute filters and date filters to a dashboard.
Due to performance considerations, this method is only usable for attributes with at most 1000 distinct values. If an attribute has more than 1000 distinct values, some values might not get selected in the filter.
When the received filter configuration is applied, the following happens:
The filter configuration overrides any filters that the dashboard may already have, such as existing attribute and date filters, URL filters, previous filter configuration, and so on.
The filter configuration is applied even if the dashboard does not yet have any filters at all.
The filter configuration takes into account existing user permissions or variable filters: if they restrict some filters or filter values in the received configuration, those filters and values are not applied.
You can use this method to apply filters to any dashboard that has embedded web content.
You can also use the event that notifies the parent application (or the embedded web content) that the filters on the dashboard have changed. See ‘Dashboard attribute and date filters changed’ in Embedded Dashboard Events.
{
gdc: {
setFilterContext: [
{
label: "attribute.filter",
type: "attribute", // (default; can be omitted for attribute filters)
value: "attribute.value.1"
},
{
label: "date.filter",
type: "date",
from: "2017-01-01", // (format: yyyy-mm-dd)
to: "2017-12-31" // (format: yyyy-mm-dd)
},
...
]
}
}
To reset a previously applied attribute filter, set its value to GDC_SELECT_ALL
. Setting the filter to GDC_SELECT_ALL
is similar to clicking Select all for an attribute filter in the GoodData Portal UI.
If the dashboard includes a corresponding attribute filter in the GoodData Portal UI (see Filter for Attributes), this filter will get all its values selected (similar to clicking Select All in the filter).
{
gdc: {
setFilterContext: [
{
label: "attribute.filter",
type: "attribute",
value: "GDC_SELECT_ALL"
}
]
}
}
Refresh a session
Description: Extends validity of an authentication session by refreshing the temporary token (see GoodData Token Types). Prevents a user being logged out after a period of inactivity.
{
gdc: {
name: 'auth.refresh'
}
}
Example
The following example embeds a dashboard and contains local methods in JavaScript for printing and editing the dashboard:
Note: In GoodData, terms workspace and project denote the same entity.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Parent app</title>
</head>
<body>
<button onclick="dashboardPrint()">Print</button> <button onclick="dashboardEdit()">Edit</button>
<iframe id="gooddata" src="https://secure.gooddata.com/dashboard.html#workspace={Workspace_URI}&dashboard={Dashboard_URI}&override=ui.link,report.export" width="100%" height="600px" frameborder="0"></iframe>
<script>
var dashboardWindow = document.getElementById('gooddata').contentWindow;
function dashboardPrint() {
var printMessage = { gdc: { name: 'tab.print' }};
dashboardWindow.postMessage(JSON.stringify(printMessage), '*');
window.alert(JSON.stringify(printMessage));
}
function dashboardEdit() {
var editMessage = { gdc: { name: 'dashboard.edit' }};
dashboardWindow.postMessage(JSON.stringify(editMessage), '*');
window.alert(JSON.stringify(editMessage));
}
</script>
</body>
</html>