Introduction
With the Spotfire® JavaScript API it is possible to embed Spotfire visualizations and dashboards into web pages. The API supports customized layout and enables integration with external web applications.
Bookmarks
A Spotfire analysis may contain bookmarks. The IDs or names of the available bookmarks can be retrieved by the Document.getBookmark or the Document.getBookmarkNames method.
function getBookmarks(callback); function getBookmarkNames(callback);
A bookmark can be applied by calling the Document.applyBookmark or the Document.applyBookmarkById method.
function applyBookmark(bookmarkName); function applyBookmarkById(id);
Bookmark names is not guaranteed to be unique in an analysis, and if two bookmarks have the same name, the applyBookmarkId method is the recommended method to use..
Document, Table and Column Properties
In a Spotfire analysis it is possible to define properties on document, table and column level. A property is a name-value pair that is globally defined in the document and can be used to define metadata or as a global variable. The analysis can respond to property changes, for example in visualizations or triggering IronPython scripts, which makes properties a powerful tool when creating interactive dashboard.
The JavaScript API contains methods to get and set the value of a document property, Document.getDocumentProperty and Document.setDocumentProperty, and to get a list of available properties, Document.getDocumentProperties.
function getDocumentProperty(propertyName, callback); function setDocumentProperty(propertyName, value); function getDocumentProperties(callback);
For data tables properties, the the corresponding methods are DataTable.getDataTableProperty, DataTable.setDataTableProperty and DataTable.getDataTableProperties
function getDataTableProperty(propertyName, callback); function setDataTableProperty(propertyName, value); function getDataTableProperties(callback);
For data column properties, the the corresponding methods are: DataColumn.getDataColumnProperty, DataColumn.setDataColumnProperty and DataColumn.getDataColumnProperties.
function getDataColumnProperty(propertyName, callback); function setDataColumnProperty(propertyName, value); function getDataColumnProperties(callback);
A property is represented by the Property class, that has the following fields:
- The name of the property
- The value of the property, which can be a string or an array of strings formatted in the users locale.
Print and Export
The JavaScript API contains several options to print and export the Spotfire analysis:
- Document.print - Launches the print wizard.
function print();
- Document.exportToPdf - Launches the export to PDF wizard.
Since Spotfire 7.12, the wizard has been extended with the more capabilities: a preview, exported visualizations use the visual theme of the analysis and the exported PDF is of higher graphical quality.
function exportToPdf();
- Document.exportReport - Exports a prepared PDF report.
Prepared reports are created from the Business Author or Analyst clients, providing full control of layout of the report.
function exportReport(reportName);
- Document.exportToPowerPoint - Launches the export to PowePoint wizard.
function exportToPowerPoint();
- Document.exportActiveVisualAsImage - Export the active visual as image. The image will be opened in a new browser tab or window.
function exportActiveVisualAsImage(width, height);
- Document.executeCustomExportTool - Executes a custom export tool. A custom export tool is a Spotfire extension creating with the SDK.
function executeCustomExportTool(toolName);
Custom Tools
- A custom tool is a Spotfire extension creating with the SDK. If a custom tool has been deployed on the Spotfire Server it is possible to execute the tool from the JavaScript API, using the Document.executeCustomTool method.
function executeCustomTool(toolName);
Recommended Comments
There are no comments to display.