@mongodb-js/charts-embed-dom
Version:
JavaScript library for embedding MongoDB Charts
101 lines (100 loc) • 3.2 kB
TypeScript
import { ChattyHostBuilder } from '@looker/chatty';
import BaseEmbedItem from './base-embed-item';
import { EmbedDashboardOptions, Scaling } from './types';
import DashboardChart from './dashboard-chart';
declare class DashboardEventSender extends BaseEmbedItem {
protected name: string;
protected ERRORS: {
SEND: string;
IFRAME: string;
};
protected COLOUR: {
LIGHT: string;
DARK: string;
};
protected options: EmbedDashboardOptions;
/** @ignore */
constructor(options: Partial<EmbedDashboardOptions>);
protected getEmbedUrl(): string;
}
declare const Dashboard_base: {
new (...args: any[]): {
setPreFilter(value: import("./types").PlainObject): Promise<void>;
getPreFilter(): Promise<import("./types").PlainObject>;
setFilter(value: import("./types").PlainObject): Promise<void>;
getFilter(): Promise<import("./types").PlainObject>;
_send(msgName: string, ...payload: unknown[]): Promise<[unknown]>;
};
} & {
new (...args: any[]): {
refresh(): Promise<void>;
_send(msgName: string, ...payload: unknown[]): Promise<[unknown]>;
};
} & typeof DashboardEventSender;
/**
* # Dashboard
*
* Allows you to interact and embed dashboards into your application.
*
* ```js
* const sdk = new EmbedSDK({ ... });
* const dashboard = sdk.createDashboard({ ... });
*
* // renders a dashboard
* dashboard.render(document.getElementById('embed-dashboard'));
*
* ```
*/
declare class Dashboard extends Dashboard_base {
private charts;
/**
* Sends the `ready` event to Charts together with the chart options
* to render the embedded dashboard in the container
* @param container where the dashboard will render
*/
render(container: HTMLElement): Promise<void>;
/**
* @returns current chartsBackground or empty string if not set
*/
getChartsBackground(): Promise<string>;
/**
* Set a custom background color for all charts.
* To clear existing value, set it to empty string.
*/
setChartsBackground(value: string): Promise<void>;
/**
* @returns whether attribution logo should be shown
*/
isShowAttribution(): Promise<boolean>;
/**
* Enable/Disable attribution logo.
*/
setShowAttribution(value: boolean): Promise<void>;
/**
* @returns get width scaling mode of embedded dashboard
*/
getWidthMode(): Promise<Scaling>;
/**
* Set width scaling mode for embedded dashboard
*/
setWidthMode(value: Scaling): Promise<void>;
/**
* @returns get height scaling mode of embedded dashboard
*/
getHeightMode(): Promise<Scaling>;
/**
* Set height scaling mode for embedded dashboard
*/
setHeightMode(value: Scaling): Promise<void>;
/**
* @returns get the dashboard chart with specified id
*/
getChart(id: string): Promise<DashboardChart>;
/**
* @returns all charts on the dashboard
*/
getAllCharts(): Promise<DashboardChart[]>;
protected _configureHost(hostBuilder: ChattyHostBuilder): ChattyHostBuilder;
}
export default Dashboard;
export type { Dashboard };