Options
All
  • Public
  • Public/Protected
  • All
Menu

Allows you to interact and embed charts into your application.

const sdk = new EmbedSDK({ ... });
const chart = sdk.createChart({ ... });

// renders a chart
chart.render(document.getElementById('embed-chart'));

// dynamically set a filter
chart.setFilter({ age: { $gt: 50 } });

Hierarchy

  • (Anonymous class)<(Anonymous class) & ChartEventSender, this> & (Anonymous class)<ChartEventSender, this> & ChartEventSender<this>
    • Chart

Index

Methods

_handleEvent

  • _handleEvent(event: EmbedChartEvent, payload: EventHandlerPayload, handlerIds: string[]): void
  • Handle the event sent from embedded app.

    Parameters

    • event: EmbedChartEvent
    • payload: EventHandlerPayload
    • handlerIds: string[]

    Returns void

_send

  • _send(eventName: string, ...payload: unknown[]): Promise<[]>
  • Send message to embedded app.

    Parameters

    • eventName: string
    • Rest ...payload: unknown[]

    Returns Promise<[]>

addEventListener

  • addEventListener(event: EmbedChartEvent, eventHandler: EventHandler, options?: EventHandlerOptions): Promise<unknown>
  • Sets an event listener

    Parameters

    • event: EmbedChartEvent

      the event you are subscribing to

    • eventHandler: EventHandler

      the callback to be executed when the event is triggered

    • Optional options: EventHandlerOptions

      optional options object, can be used to customise when handler is called

    Returns Promise<unknown>

getData

  • getData(): Promise<object>
  • Returns Promise<object>

    the data of the embedded chart.

getFilter

  • getFilter(): Promise<object>
  • Returns Promise<object>

    the current filter applied to the embedded chart.

getHighlight

  • getHighlight(): Promise<object>
  • Returns Promise<object>

    the current highlight applied to the embedded chart.

getMaxDataAge

  • getMaxDataAge(): Promise<number>
  • Returns Promise<number>

    the number of seconds before a chart or dashboard's data expires

getRefreshInterval

  • getRefreshInterval(): Promise<number>
  • deprecated

    This method is deprecated. Please use the 'autoRefresh' option with the 'maxDataAge' option to configure how often the chart refreshes.

    Returns Promise<number>

    the number of seconds a chart will wait before refreshing

getTheme

  • getTheme(): Promise<string>
  • Returns Promise<string>

    the current theme applied to the chart or dashboard

isAutoRefresh

  • isAutoRefresh(): Promise<boolean>
  • Returns Promise<boolean>

    whether auto refreshing is enabled

refresh

  • refresh(): Promise<void>
  • Triggers a refresh of the chart or dashboard (if it has been embedded).

    Returns Promise<void>

    a promise that resolves once the chart or dashboard updated its data

removeEventListener

  • removeEventListener(event: EmbedChartEvent, eventHandler: EventHandler, options?: EventHandlerOptions): Promise<unknown>
  • Removes an event listener

    Parameters

    • event: EmbedChartEvent

      the event you are unsubscribing from

    • eventHandler: EventHandler

      the event listener function you are unsubscribing from

    • Optional options: EventHandlerOptions

      optional options object used when addEventListener

    Returns Promise<unknown>

render

  • render(container: HTMLElement): Promise<void>
  • Renders an embeddable item into the given container.

    This method should only be called once, and successive attempts to call render will fail with an error.

    Parameters

    • container: HTMLElement

    Returns Promise<void>

    a promise that will resolve once the item has successfully been embedded

setAutoRefresh

  • setAutoRefresh(value: boolean): Promise<void>
  • Enable/Disable auto refreshing.

    Parameters

    • value: boolean

    Returns Promise<void>

setFilter

  • setFilter(value: object): Promise<void>
  • Sets the filter to apply to the embedded chart.

    This expects an object that contains a valid query operators. Any fields referenced in this filter are expected to be whitelisted in the "Embed Chart" dialog for each Chart you wish to filter on.

    Parameters

    • value: object

    Returns Promise<void>

setHighlight

  • setHighlight(value: object): Promise<void>
  • Sets the highlight to apply to the embedded chart.

    This is the exact same object that can be used in 'setFilter'. However, it doesn't support some query expressions

    Parameters

    • value: object

      The highlight object to be applied to the chart

    Returns Promise<void>

setMaxDataAge

  • setMaxDataAge(value: number): Promise<void>
  • Set the number of seconds a chart or dashboard's data expires.

    Parameters

    • value: number

    Returns Promise<void>

setRefreshInterval

  • setRefreshInterval(value: number): Promise<void>
  • Set the number of seconds a chart will wait before refreshing.

    The minimum refresh interval is 10 seconds. To disable, set the refresh interval to 0.

    deprecated

    This method is deprecated. Please use the 'autoRefresh' option with the 'maxDataAge' option to configure how often the chart refreshes.

    Parameters

    • value: number

    Returns Promise<void>

setTheme

  • setTheme(value: Theme): Promise<void>
  • Sets the color scheme to apply to the chart or dashboard.

    If the theme is set to 'dark' and you have specified a custom background color, you should ensure that your background color has appropriate contrast.

    Parameters

    • value: Theme

    Returns Promise<void>

Static _send

  • _send(msgName: string, ...payload: unknown[]): Promise<[]>
  • Send message to embedded app.

    Parameters

    • msgName: string
    • Rest ...payload: unknown[]

    Returns Promise<[]>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc