Dashboard
The Dashboard
class in Vizzly represents the core interface for creating and managing dashboards. It offers a variety of methods to configure and customize the dashboard's appearance, layout, and functionality.
Initialization
A Dashboard
can be initialized with a mandatory dashboard ID and optional attributes. These attributes can include display configurations, custom fields, and a component library, allowing for a highly customizable dashboard setup.
Basic Example
To create a new Dashboard
instance in Vizzly, use the following TypeScript syntax:
import { Vizzly } from "@vizzly/services;
new Vizzly.Dashboard('<< Parent Dashboard ID >>');
API
/**
* Constructs a new instance of the Dashboard class.
* @param id - The id of the dashboard.
* @param attributes - The attributes of the dashboard.
* @throws Error if the dashboard id is undefined.
*/
constructor(id: string, attributes?: DashboardAttributes)
/**
* Sets the display configuration for the dashboard.
* @param display - An array of Row or Header objects representing the new
* display configuration for the dashboard.
* @throws Error if the dashboard instance is undefined.
*/
setDisplay(display: (Row | Header)[])
/**
* Sets the custom fields of the dashboard.
* @param customFields
*/
setCustomFields(customFields: CustomFields)
/**
* Sets the component library of the dashboard.
* @param library
*/
setLibrary(library: Library)
/**
* Builds a partial DashboardType object.
* @returns A partial DashboardType object.
*/
build = (): T
Types
/** Custom fields for a dashboard */
export type CustomFields = {
[dataSetId: string]: Array<CustomField>;
};
/**
* Represents a DashboardAttributes type.
* @param display - The display configuration for the dashboard.
* @param customFields - The custom fields of the dashboard.
* @param library - The component library of the dashboard.
*/
export type DashboardAttributes = {
display?: (Row | Header)[];
customFields?: CustomFields;
library?: Library;
};