UNPKG

@mongodb-js/charts-embed-dom

Version:

JavaScript library for embedding MongoDB Charts

35 lines (34 loc) 1.72 kB
import { EventSender, PlainObject } from '../types'; /** * A class extender for common chart methods * @param Sender the parent class to be extended */ export declare function CommonChart<S extends EventSender>(Sender: S): { new (...args: any[]): { /** * Sets a highlight to the state of the chart entity in the Charts app component. * The chart entity can be an embedded chart or an embedded dashboard chart. * The highlight gets applied to the embedded chart or dashboard chart. * * This is the exact same object that can be used in 'setFilter'. * However, it [doesn't support some query expressions] (https://www.mongodb.com/docs/charts/filter-embedded-charts/#filter-syntax) * And there are some specifics about what is highlightable (https://www.mongodb.com/docs/charts/highlight-chart-elements/) * * @param value The highlight object to be applied to the chart * @returns a promise that resolves once the highlight is saved and the component rerendered */ setHighlight(value: PlainObject): Promise<void>; /** * Returns the current highlight applied to the embedded chart or dashboard chart * The highlight value is taken from the state of the chart entity in the Charts app component. * * @returns a promise that resolves once the highlight is taken from the Charts state */ getHighlight(): Promise<PlainObject>; /** * @returns the data of the embedded chart or dashboard chart */ getData(): Promise<object>; _send(msgName: string, ...payload: unknown[]): Promise<[unknown]>; }; } & S;