The action creates an outbound API to pass data from MashZone NextGen dashboards to an embedding system, for example, an external web application.
The API data structure consists of the dashboard id, the specified external widget id (URL-ID, see: Use dynamic URL selection), the selected coordinate names (columns), the selected coordinate values, and the name of the event triggering the outbound data push. See the MZNG outbound data structure example below.
Procedure
Create a dashboard or open a dashboard in the dashboard editor.
Click an inserted chart widget that supports actions. The relevant properties dialog is displayed.
Click the Action tab.
Select the action trigger event in the Trigger drop-down menu.
The available actions depend on the selected widget.
Activate the Post data option.
If you disable the option, the action is not deleted but it is deactivated in view mode.
Click Configure to set the action configuration.
Select the coordinates that you want to add to the outbound data.
The coordinates selected are added to the outgoing data, that is displayed in the Outbound data preview box.
Click Save action.
Your settings are applied and your action is specified for the selected widget.
Example
The outbound data is structured as follows:
{
"dashboardGUID": "d216bf4a-bd12-476d-aa5d-2a07a3efd4bf",
"outbound Widgets": [
{
"extId": "widget2",
"outboundData": [
{ "name": "ARTIST",
"value": "Bob Dylan",
"type": "TEXT"
},
{
"name": "PRICE",
"value": "11.0",
"type": "NUMERIC"
}
],
"trigger": "onSelectionChange"
}
]
}
By triggering the Post data action, MashZone NextGen sends the configured outbound data using window.postMessage() events. In order to receive the events in an embedding system a listener function must be implemented as in the example below:
function listener(event){
// The origin of the window that sent the message
// at the time postMessage was called
// Format: protocol://host:port var origin = event.origin
// A reference to the window object that sent the message var source = event.source;
// The posted data object var data = event.data;
}
if (window.addEventListener){ addEventListener("message", listener, false) } else { attachEvent("onmessage", listener) }