Jump to content
  • Spotfire® JavaScript API Overview: Concepts Part 2


    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. This section covers Bookmarks, Document, Table & Column properties, Print & Export, and Custom Tools.

    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.getDataColumnPropertyDataColumn.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:

     function print();
     

    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(); 
     

    Prepared reports are created from the Business Author or Analyst clients, providing full control of layout of the report.

     function exportReport(reportName); 
     
     function exportToPowerPoint();
     
     function exportActiveVisualAsImage(width, height);
     
     function executeCustomExportTool(toolName);
     

     

    Custom Tools

     function executeCustomTool(toolName);
     

    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...