Methods

This page describes the available methods within the HTML Canvas class

HTML Canvas methods

Method
Description

getHeaders

Returns the appropriate authentication headers for public or private dashboards.

openDrawer

Embeds a URL in a drawer and displays it.

setDashboardDevices

Changes the currently selected device or devices in single-device or multi-device dynamic dashboards.

setDashboardDateRange

Changes the selected time range in a dashboard.

setRealTime

Turns the dashboard's real-time updates on or off.

refreshDashboard

Refreshes dashboard data in all widgets.

setDashboardLayer

Navigates to a different layer.

getHeaders

Arguments: None

Signature: ubidots.getHeaders()

Return:

{
  Authorization: "Bearer receivedJWTToken",
  Content-type: "application/json"
}

openDrawer

Arguments: options: Object [Mandatory] => An object containing the content's URL and the drawer's width in pixels:

Signature:

Return: None

setDashboardDevices

Arguments: deviceIds: string [Mandatory] ⇒ Comma-separated string with the IDs of the devices you want to set.

Signature: ubidots.setDashboardDevices(<deviceIds>)

Return: None

setDashboardDateRange

Arguments: timeframe: Object [Mandatory] => An object containing the start and end timestamps:

Signature: ubidots.setDashboardDateRange(<timeframe>)

Return: None

setRealTime

Arguments: rt: Bool [Mandatory] => A boolean indicating whether real-time updates are enabled.

Signature: ubidots.setRealTime(<rt>)

Return: None

refreshDashboard

Arguments: None

Signature: ubidots.refreshDashboard()

Return: None

setFullScreen

Arguments: screenSetting: string(toggle | enable | disabled) [Mandatory] => A string representing the full-screen setting.

Signature: ubidots.setFullScreen(<screenSetting>)

Return: None

setDashboardLayer

Arguments:

  • layer: string [Mandatory] ⇒ layer ID or label.

    • Use ID as a plain string: "6926000dcb198b4d10067b58"

    • Use label prefixed with ~: "~Layer-2"

  • queryParams: Object [Optional] ⇒ An object where each key/value pair will be added as a query param.

    • Allowed value types: string | number | boolean

    • Arrays are NOT allowed. If you need multiple values, pass a comma-separated string, e.g. "id1,id2,id3"

Last updated

Was this helpful?