To use the JavaScript API object specified below, be sure to specify the URL to the JavaScript API file in your web page. For more information, see Embedding with Javascript API or code samples. The JavaScript API file is a library that contains functions for interacting with the JavaScript API. It's a minified file and production-ready to be downloaded by the browser.
This section defines the available options for configuring the Knowi Javascript Class.
| Name | Type | Descriptions |
| type | string | type of asset/view to embed Supported values: share for dashboard, secure for secure hash dashboard, shareWidget for widget, shareWidgetSecure for secure hash widget, single for single sign-on, nlp for natural language query aiConverse for long form AI chat with datasets and documents (sso only) |
| dashboard | string | share URL of dashboard/widget |
| dashboardId | integer | ID of dashboard/widget |
| hash | string | Encrypted hash from secure share dashboard/widget. Must be used with type: secure, shareWidgetSecure
|
| token | string | session token from Single Sign-On. Needed with type: single
|
| renderType | string | specifies how embed will be rendered. Options are object, iframe. Defaults to iframe
|
| url | string | url for on-premise deployments. Defaults to www.knowi.com |
| themeId | string | ID of a custom theme to apply to the embedded content. Overrides the dashboard-level theme. Widget-level themes, custom widget properties, and custom CSS take precedence over themeId
|
| view | object | customizable options for the embedded display |
This section defines the available options for configuring the view object from the Knowi class.
| Name | Type | Description |
| title | bool | enable widget title and action menus |
| filter | true | false | "dashboard" | control widget filter icon visibility. true = always show, false = always hide, "dashboard" = respect the dashboard's own filter icon setting |
| autoHeight | bool | automatically adjust dashboard height to div |
| border | bool | enable borders around the widget |
| widgetSpacing | integer | spacing between widgets (px). Possible values between 0-200 |
| setting | bool | enable widget settings |
| resize | bool | enable widget on a dashboard to be resized |
| drag | bool | enable widget on a dashboard to be rearranged |
| scroll | bool | enable scroll on a dashboard |
| header | bool | enable dashboard header including dashboard name, settings, and dashboard filter |
| dashListIcon | bool | enable/disable the dashboard listing dropdown (defaults to true) Note: Only applicable for 'single' type of embed. (since the others have it off by default). |
| backgroundColor | string | background-color of dashboard Supported formats: rebeccapurple,HEX value: #92a8d1,RGB: rgb(201, 76, 76,RGBA: rgba(201, 76, 76, 0.6)
|
| analytics | bool | enable Ad-hoc Analytics mode for widgets. Applicable with types: shareWidget, shareWidgetSecure |
instantSightsIcon |
bool | enable Instantsights capabilities (defaults to false) |
| aiAgent | bool | enable Agentic AI capabilities (defaults to false) |
| chat | bool | enable customer support chat |
| menu | bool | enable side menu bar with system actions as needed |
| menuOptions | object |
disable side navigation menu. Defaults to showing all menu options.
|
| css | array | inject custom CSS files to override the default styling. Example: ['https://rawgit.com/AntonLapshin/csharp/master/custom1.css', '...'] |
| contentFilters | array | JSON array of user content filters. Applicable with types: share, shareWidget Example: [{"fieldName": "department", "values": ["sales", 19], "operator": "="}, {...}] |
| nlpOptions | object |
customizable settings for NLP search bar.
|
| dashFiltersBar | bool | enable dashboard filters top bar |
| dashFiltersIconToSide Panel | bool | enable filter icon in top filters bar clickable, which open up the right side dashboard filters panel |
| aiConverseOptions | object |
customizable settings for embedding the long form ai chat useSources datasets, documents, or all. Example: “sources”: {“datasets”:[”Campaigns”, “Sent”],”documents”:[“doc1,”]}
|
Menu Options
The menu options available are:
- logo - Enables displaying the logo on the dashboard by setting it to true
- dashboards - Enables dashboards by setting them to true
- widgets - Enables widgets on setting it to true
- queries - Enables queries on setting it to true
- alerts - Enables alerts on setting it to true
- reports - Enables reports on setting it to true
- more - Enables the more button on setting it to true
- help - Enables the help option on setting it to be true
- profile - Enables setting up and maintaining profiles by setting them to true
- ml - Enables ML on setting it to true
- ai - Enables AI button on the navigation menu
- logout - When disabled users will not see the option to log out
- agent - Enables agent to set it to true
- opsdash - Enables ops dashboards by setting it to true
- dashSettings - Enable or disable the settings icon on the dashboard
- nlpPrompt - Enable or disable the NLP prompt on the dashboard
CSS Customization
Your own custom CSS can be injected into the API. Simply specify a comma-separated list of CSS files and their full path during the initialization.
Knowi.render('#cloud9charts', {
type: 'touchdown',
username: 'name',
password: 'pass',
view: {
title: true,
css: ['https://rawgit.com/AntonLapshin/csharp/master/custom1.css', 'https://rawgit.com/AntonLapshin/csharp/master/custom2.css']
},
}, function() {
alert("Loaded")
});
See sample JSFiddle.
Filters
To pass in filters:
Knowi.render('#cloud9charts', {
type: 'share',
dashboard: 'CnzzWr6ZGrii4BYsa295HoVWzNB7VaZey6StgO1uFw2kie'
view: {
title: true,
contentFilters: [
{
"fieldName":
"opened",
"values":[1000],
"operator":">"
},
{
"fieldName":"message_type",
"values":["marketing"],
"operator":"="
}
]
},
}, function() {
alert("Loaded")
});
Note: Secure URL modes require contentFilters to be encrypted.
Themes
To apply a custom theme to an embedded dashboard, pass the theme ID as themeId in the top-level configuration object:
Knowi.render('#knowi-div', {
type: 'single',
token: 'YOUR_SESSION_TOKEN',
themeId: 'YOUR_THEME_ID',
view: {
title: true,
// ...
}
}, function() {});
Theme styling is applied in the following order of precedence (highest to lowest):
- Custom CSS
- Custom widget properties
- Widget-level theme
themeId
themeId overrides any dashboard-level theme configured in Knowi. However, widgets with explicit theme assignments (e.g., "light" or "dark") are unaffected -- only widgets inheriting their theme from the dashboard will reflect the themeId value.