Who can use the API?
What can I do with the API?
Do things such as:
- Build new types of widgets
- Tweak out-of-the-box visualizations to match the exact look and feel you are looking for
- Fine tune the application behavior for specific needs
- Apply custom formatting
- Click the Dashboard menu button in the top-right corner of the Dashboard and selectEdit Script.
- Click Save and refresh your dashboard.
- Hover over the top-right of the widget and click to edit the widget.
- Click the Widget menu in the top-right corner of the widget and select Edit Script.
- Browse to your Plugins folder: C:\Program Files\Sisense\PrismWeb\plugins, and open the specific plugin folder. If you are creating a new plugin, create a new plugin folder under thePlugins folder.
- Open the widget.js file in an editor, and update the code.
Creating New Widgets
The easiest way to create a new widget in Sisense is to modify an existing widget, however you can create widgets from scratch. This procedure describes how to create a new widget, but the principles described here can be applied to modifying existing widgets as well.
After you have created a widget, it is displayed in your Widget’s list in the Sisense Web Application.
To create a new widget plugin:
Create or locate your Plugins folder: C:\Program Files\Sisense\PrismWeb\plugins. If the plugins folder does not yet exist, create it under PrismWeb.
In the plugin folder, create the following files:
plugin.json: This file defines your widget's name and refers to the source files that define your widget’s styling and functionality. See Building a Widget for more information.
widget.css: This CSS file contains information about the style of your widget. See Styling Your Widget for more information.
widget.js: This file defines your widget’s functionality. See Defining a Widget’s Functionality for more information.
Log into a dashboard, and create a new widget. Open the Advanced configuration, and you should see the name of your new plugin in the list of available chart types.
Building a Widget
Each widget you create must contain a plugin.json file. This file should be in JSON format with all quotes and without trailing comma.
The plugin.json file can contains the following keys:
name: Contains a string that represents the name of your widget as it will be displayed in the Sisense Web Application.
pluginInfraVersion: An integer that defines which version of the Sisense JS API infrastructure you are using for your widget. From 6.6.1 onwards, new widgets should use the latest infrastructure. There are two possible values:
1: (Default) Plugins prior to Sisense V6.6.1.
2: Plugins created from Sisense V6.6.1 and later.
style: An array that contains string references to CSS files that define your widget’s appearance. See Styling Your Widgets for more information.
Source and style files should be saved in the same folder as your plugin.json file or referenced in the plugin.json file with a relative path.
Below is an example of a plugin.json:
Defining a Widget’s Functionality
Styling Your Widget
You can define the the look and appearance of your widgets by including CSS files in your plugin folder and then referring to these files when relevant.
To include this file in your widget, it should be referred to in the source array of the plugins.json file.
If your widget includes any graphics or images, these can be included in an Images folder in your plugin’s folder. To access images in the folder, provide a relative path to the Images folder.
Below is an example of a widget that refers to an image saved in the Images folder:
Sisense enables you to debug your plugins while they are in production. Inside your plugins folder located in the directory C:\Program Files\Sisense\PrismWeb\plugins is the entry.json file, which determines if your plugin files are condensed by Sisense in production and which version of your plugin to use.
The entry.json file has the following structure:
There are two objects you can define:
watchIgnore: This array defines a list of plugin files and folders that are to be ignored by Sisense. When you modify your plugin files, it triggers a new plugin build cycle. By adding your files and folders to this array, Sisense ignores any changes to your plugins and continues using the plugin that was available during the last plugin build cycle. Strings in this array are in listed as regular expressions so you define exactly which file and folder to ignore.