Extension JS API endpoints

JavaScript module returns an object that may implement one or more endpoints. These endpoints allow you to define supported visual types, expose custom settings, and customize the visual rendering lifecycle.

version()

Required

It returns the version of the extension API that this object implements. Currently, the only supported version string is "1". The value must be returned as a string and not as a number.

supported()

Optional

It Defines the visual types supported by the extension. The visualType property can contain either a string visual type or an array of strings that contain the types of visuals supported.

For example:

supported: {
  visualType: "trellis-bars"
},
Table 1. Supported visual types
Visual Type Object Name
Table table
Cross Tabulation crosstab
Bars trellis-bars
Lines trellis-lines
Combo combo
Areas trellis-areas
Grouped Bars trellis-groupedbars
KPI kpi
Packed Bubbles packed-bubbles
Scatter scatter
Flow flow
Funnel funnel
Pie pie
Radial radial
Chord chord
Correlation Heatmap correlation
Correlation Flow correlation-flow
Calendar Heatmap calendar-heatmap
Map map
Interactive Map leaflet
Sparklines sparklines
External Link link
Histogram histogram
Extension extension
Field Statistics column-stats
Queries rawtable
Rich Text html
Network network
Dendrogram dendrogram
Treemap treemap
Bullet bullet
Gauge gauge
Word Cloud wordcloud
Box Plot boxplot
Timeline timeline

settings()

Optional

It defines custom settings that are exposed to the extension. The function returns an array of setting definitions that can be configured by users.

settings: function() {
  return [
    {
      id: "Column Name"
    },
    {
      id: "Max bar width",
      defaultValue: "50"
    },
    {
      id: "Color",
      defaultValue: "steelblue"
    }
  ];
},
Table 2. Settings Specifications
Member Name Description Default Value Mandatory
id Column Name The ID of this setting. None Yes
displayName Column Name Name used to display this setting. Same as ID No
type String The data type of the variable. Supported types include String, and boolean. String No
defaultValue "" The default value for this setting. null No

disableDraw()

Optional

It returns a boolean value that determines whether the visual should be rendered. When the function returns true, visual rendering is disabled.

beforeDraw()

Optional

It executes after receiving data but before the draw event on the visual.

afterDraw()

Optional

It executes after the draw event on the underlying visual.

afterDataRequest()

Optional

It executes after creating the request object, but before the data request call. This function accepts the current request object in the arguments, adds your modifications, and returns an updated valid request object. If the function does not return a valid request object, the request is not sent, and the system returns an error.