Custom Extension API Documentation


Category: Workbook Extension APIs

getAllCanvasDisplayNames() → {Array.<string>}

Returns a list of all display names for canvases available in the workbook.
Returns:
Array.<string>: The list of all the canvas names
Example
 
   Sample Code:
   const CanvasNames = this.getAllCanvasDisplayNames();
   console.log(CanvasNames);
                        
Note: "this" represents the visualization instance. Make sure that the visualization is fully rendered before invoking them. You can call this API in the render or performMainAction method of your custom extension.

getActiveCanvasDisplayName() → {string}

Returns the display name of the active canvas.
Returns:
string: The canvas name
Example

    Sample Code:
    const ActiveCanvasName = this.getActiveCanvasDisplayName();
    console.log(ActiveCanvasName);
   
Note: "this" represents the visualization instance. Make sure that the visualization is fully rendered before invoking them. You can call this API in the render or performMainAction method of your custom extension.

getAllVizTitlesFromActiveCanvas() → {Array.<string>}

Returns a list of all the visualization titles from the active canvas.
Returns:
Array.<string>: The list of all the visualization titles from the active canvas
Example

    Sample Code:
    const AllVizTitles = this.getAllVizTitlesFromActiveCanvas();
    console.log(AllVizTitles);
   
Note: "this" represents the visualization instance. Make sure that the visualization is fully rendered before invoking them. You can call this API in the render or performMainAction method of your custom extension.

getAllVizPluginNamesFromActiveCanvas() → {Array.<string>}

Returns a list of all the visualization's plugin names from the active canvas.
Returns:
Array.<string>: The list of all the plugin names from the active canvas
Example

    Sample Code:
    const VizPluginNames = this.getAllVizPluginNamesFromActiveCanvas();
    console.log(VizPluginNames);
   
Note: "this" represents the visualization instance. Make sure that the visualization is fully rendered before invoking them. You can call this API in the render or performMainAction method of your custom extension.

Category: Visualization Settings & Properties Panel Usage APIs

getVizSpecificViewConfigSettingJSON() → {object}

Retrieves an object containing the current visualization-specific configuration settings.
Returns:
object: A key-value map where each key represents a visualization-specific property (e.g., {"minValue": 100, "enableMode": true})
Example

    Sample Code:
    this.getVizSpecificViewConfigSettingJSON(); 


Note: "this" represents the visualization instance.

setVizSpecificViewConfig() → {void}

Updates the visualization with new configuration settings provided in the specified object.
Returns:
void
Example

    Sample Code:
    var oSettings = this.getSettings(); // this represents the visualization settings
    this.setVizSpecificViewConfig(oSettings, oConf);
    // Example: oConf = {"minValue" : 300}; 
                  

Note: "this" represents the visualization instance.

_addVizSpecificPropsDialog() → {void}

This method adds custom property gadgets to the visualization's Properties panel. It is typically overridden to extend the default configuration interface by injecting additional controls for user-defined visualization settings. This applies only to basic or data visualization plugins.
Returns:
void
Example

    Sample Code:
    /**
    * @param {Object} tabbedPanelsGadgetInfo - Information related to the tabbed panels gadget.
    */
    CustomViz.prototype._addVizSpecificPropsDialog = function (tabbedPanelsGadgetInfo) {
        CustomViz.superClass._addVizSpecificPropsDialog.call(this, tabbedPanelsGadgetInfo); 
    }; 
                  

Note: "this" represents the visualization instance. It's important to call the superclass APIs so that the default gadgets are added to the properties panel.

This method extends or customizes the base implementation of _addVizSpecificPropsDialog by adding visualization-specific settings to the extension's configuration interface, typically displayed in the Properties tab next to the Grammar panel. The tabbedPanelsGadgetInfo parameter is an object that contains data relevant to the tabbed panels gadget. This information is used to populate the dialog with configurable options such as enabling labels, switching the scale to logarithmic, and other visualization-specific controls.

doAddVizSpecificPropsDialog() → {void}

This method can be used to add custom property gadgets to the visualization's Properties panel. It is intended for embeddable visualizations.
Returns:
void
Example

    Sample Code:
    /**
    * @function doAddVizSpecificPropsDialog
    * @param {Object} oTransientRenderingContext - The transient rendering context object.
    * @param {gadgets.TabbedPanelsGadgetInfo} oTabbedPanelsGadgetInfo - The tabbed panels gadget info instance.
    */
    CustomViz.prototype.doAddVizSpecificPropsDialog = function (oTransientRenderingContext, oTabbedPanelsGadgetInfo) {
        CustomViz.superClass.doAddVizSpecificPropsDialog.apply(this, arguments);
    }; 
                  

Note: "this" represents the visualization instance. It's important to call the superclass APIs so that the default gadgets are added to the properties panel.

This method populates the Properties panel with visualization-specific configuration gadgets for embeddable visualizations. It is typically called by _addVizSpecificPropsDialog and uses the oTabbedPanelsGadgetInfo to define the layout and controls shown in the Properties tab. It also sets the appropriate tab panel for display. Use this method during the render phase to define custom settings.

_onSettingsChanged() → {void}

Triggered whenever the default settings for the visualization are modified. Use this method to refresh the rendering based on updated configurations.
Returns:
void
Example

    Sample Code:
    /**
    * @function _onSettingsChanged
    */
    CustomViz.prototype._onSettingsChanged = function() {
        const oTransientVizContext = this.assertOrCreateVizContext();  // oTransientVizContext - The visualization's transient context
        //oTransientRenderingContext - The visualization's transient rendering context.
        const oTransientRenderingContext = this.createRenderingContext(oTransientVizContext);
        this.render(oTransientRenderingContext);  // re-render the visualization so that the changes get reflected
    }; 
                  

Note: "this" represents the visualization instance.

resizeVisualization(oVizDimensions, oTransientVizContext)() → {void}

This method handles resizing the visualization in response to size changes, such as window resizing or the addition of other plugins. Use this method for non-embeddable visualizations. For embeddable visualizations, use resizeViz().
Returns:
void
Example

    Sample Code:
    /**
    * @function resizeVisualization
    * @param {Object} oVizDimensions - The visualization's dimension information.
    * @param {Object} oTransientVizContext - The visualization's transient context.
    */
    CustomViz.prototype.resizeVisualization = function (oVizDimensions, oTransientVizContext) {
        const oTransientRenderingContext = this.createRenderingContext(oTransientVizContext);
        this.render(oTransientRenderingContext);  // re-render for the changes to reflect
    }; 
                  

Note: "this" represents the visualization instance.