Altair® Panopticon


JavaScript Part

The JavaScript dashboard part allows the designer of a workbook to include a bespoke JavaScript code inside a dashboard. This dashboard part also has support for loading of the data from the Panopticon Visualization Server, inside the same downloading framework as the rest of the dashboard.

Adding JavaScript Part

  1. Draw a rectangle on the dashboard canvas to display the Parts dialog.

  1. Click the JavaScript part  icon in the General section of the Parts dialog.

The JavaScript part is displayed in the dashboard canvas. By default, it shows a box with the following supported functions:

    • postLink(config)

    • getDataRequestObject(config)

    • handleDataUpdate(config, data)

The argument config in all of the three functions will be an object with a single property element. config.element is the DOM element that is to be used if a UI is required. The same instance of config will be used throughout the lifetime of the JavaScript dashboard part. This means it can also be used to save references to other DOM elements, functions, or data.

  1. Define the functions, as required:

    • postLink(config) is called after the dashboard part is added to the DOM. The function can optionally return a destroy function. The return value is called when the dashboard part is disposed and removed from the DOM. This will happen when the user switches to another dashboard. NOTE: This is the only function that is required to implement this dashboard part.

    • getDataRequestObject(config) is optional, and only used if the dashboard part needs to load data. The function specifies which columns to load, aggregation, and the shape of the data. The data table used for the dashboard part is selected in the Designer, in the drop-down list.

For this sample, there are two available data tables:

    • handleDataUpdate(config, data) is the callback used when the data has finished loading from the Panopticon Visualization Server. If the data table consists of a realtime data source then this function will be called for each update from the Panopticon Visualization Server.


Below is a simple JavaScript example, with no data loading: