dashboard-js-devexpress-dot-dashboard-dot-model-ab12c017.md
Contains the full description of a dashboard used to visualize data.
export class Dashboard extends SerializableModel implements IMasterFilterItemsProvider, IColorSignaturesProvider, ICustomPropertiesProvider
The Dashboard class contains a complete description of a dashboard, including the collection of dashboard items and groups, data binding information, layout and appearance settings, etc.
To create a new dashboard in code, do the following.
If necessary, you can add dashboard parameters (Dashboard.parameters), change dashboard title settings (Dashboard.title), customize a global color scheme (Dashboard.colorScheme), etc.
Use the dashboard property to specify the currently opened dashboard.
IMasterFilterItemsProvider
IColorSignaturesProvider
ICustomPropertiesProvider
SerializableModel Dashboard
Initializes a new instance of the Dashboard class.
constructor(
dashboardJSON?: any,
serializer?: DevExpress.Analytics.Utils.ModelSerializer
)
| Name | Type | Description |
|---|---|---|
| dashboardJSON | any |
A JSON object used for dashboard deserialization. Do not pass this parameter directly.
| | serializer | ModelSerializer |
An object used for dashboard deserialization. Do not pass this parameter directly.
|
Provides access to a dashboard color scheme.
colorScheme: ko.ObservableArray<DevExpress.Dashboard.Model.ColorSchemeEntry>
| Type | Description |
|---|---|
| ObservableArray<ColorSchemeEntry> |
The color scheme used to color dashboard item elements.
|
More information: Coloring.
Gets or sets the default currency for the Web Dashboard.
currencyCultureName: ko.Observable<string>
| Type | Description |
|---|---|
| Observable<string> |
A string that specifies the name of a culture that defines the currency format settings.
|
Provide access to the custom properties available for the current dashboard.
customProperties: DevExpress.Dashboard.Model.CustomProperties
| Type | Description |
|---|---|
| CustomProperties |
A CustomProperties object that provides access to the dashboard’s custom properties.
|
More information: Custom Properties.
See Also
Create Custom Properties in the Web Dashboard
Specifies the dashboard definition in a JSON format.
dashboardJSON: any
| Type | Description |
|---|---|
| any |
A dashboard definition in JSON format.
|
You can use the dashboardJSON property to create a dashboard by providing the dashboard definition in the JSON format.
Specifies the collection of dashboard data sources.
dataSources: ko.ObservableArray<DevExpress.Dashboard.Model.DataSource>
| Type | Description |
|---|---|
| ObservableArray<DataSource> |
An array of DataSource objects that are dashboard’s data sources.
|
The following example shows how to get the existing data source from the opened dashboard and use it as a data source for dashboard items.
// Use the line below for a modular approach:
// import * as Model from 'devexpress-dashboard/model'
// Use the line below for an approach with global namespaces:
// var Model = DevExpress.Dashboard.Model;
// ...
public createDataSource() {
var dashboard = this.webDashboard.dashboard();
// Get the existing data sources.
var sqlDataSource = <Model.SqlDataSource>dashboard.dataSources()[0];
var excelDataSource = <Model.SqlDataSource>dashboard.dataSources()[1];
// Create data items for the Grid.
var gridCategoryName = new Model.Dimension();
gridCategoryName.dataMember("CategoryName");
var gridUnitPrice = new Model.Measure();
gridUnitPrice.dataMember("UnitPrice");
// Create the Grid dashboard item and bind it to data.
var gridItem = new Model.GridItem();
gridItem.dataSource(sqlDataSource.componentName());
gridItem.dataMember(sqlDataSource.queries()[0].name());
// Create data items for the Geo Point Map.
var geoPointMapImport = new Model.Measure();
geoPointMapImport.dataMember("Import");
var geoPointMapLatitude = new Model.Dimension();
geoPointMapLatitude.dataMember("Latitude");
var geoPointMapLongitude = new Model.Dimension();
geoPointMapLongitude.dataMember("Longitude");
// Create the Geo Point Map dashboard item and bind it to data.
var geoPointMapItem = new Model.GeoPointMapItem();
geoPointMapItem.dataSource(excelDataSource.componentName());
// ...
}
Provides access to a collection of dashboard item groups.
groups: ko.ObservableArray<DevExpress.Dashboard.Model.GroupItem>
| Type | Description |
|---|---|
| ObservableArray<GroupItem> |
A collection of GroupItem objects.
|
A dashboard item group (the GroupItem object) arranges dashboard items within the Dashboard. It groups dashboard items into a separate layout group. Moreover, the dashboard item group provides the capability to affect interaction between dashboard items within and outside of the group.
Add dashboard group to the groups collection to it them in the dashboard.
Provides access to a collection of dashboard items.
items: ko.ObservableArray<DevExpress.Dashboard.Model.DashboardItem>
| Type | Description |
|---|---|
| ObservableArray<DashboardItem> |
A collection of DashboardItem objects that are dashboard items.
|
Add dashboard items to the items collection to show them in the dashboard.
Provide access to the root dashboard layout group.
layout: ko.Observable<DevExpress.Dashboard.Model.DashboardLayoutGroup>
| Type | Description |
|---|---|
| Observable<DashboardLayoutGroup> |
A DashboardLayoutGroup object that specifies the root dashboard layout group.
|
This layout group contains child layout items and groups used to arrange dashboard items. Use the DashboardLayoutGroup.childNodes property to get the collection of child nodes.
Provides access to the dashboard layout settings.
layoutOptions: DevExpress.Dashboard.Model.LayoutOptions
| Type | Description |
|---|---|
| LayoutOptions |
A LayoutOptions object that contains the dashboard layout settings.
|
You can use the LayoutOptions.height and LayoutOptions.width properties to adjust the dashboard layout. These properties return the LayoutDimensionOptions object that contains settings for the corresponding dimensions of the dashboard surface.
The following code snippet specifies the height and aligns the dashboard’s content horizontally:
Handle the DashboardControlOptions.onDashboardInitializing event and call the custom setLayout function:
function setLayout(e) {
if (e.dashboard.id == "dashboard2") {
e.dashboard.layoutOptions.width.mode("Auto");
e.dashboard.layoutOptions.height.mode("Fixed");
e.dashboard.layoutOptions.height.value(3000);
}
Specifies a collection of dashboard parameters.
parameters: ko.ObservableArray<DevExpress.Dashboard.Model.Parameter>
| Type | Description |
|---|---|
| ObservableArray<Parameter> |
A collection of Parameter objects that are dashboard parameters.
|
Add parameters to the parameters collection to show them in the dashboard.
Specifies whether to load dashboard data only after the user submits parameter values.
requestParameters: ko.Observable<boolean>
| Type | Description |
|---|---|
| Observable<boolean> |
true to load a dashboard data after the user submits dashboard parameters; otherwise, false.
|
See the following article for more information: Create a Dashboard Parameter on the Web.
Gets or sets a string value of the dashboard state.
get stateString(): string
set stateString(stateVal: string)
| Type | Description |
|---|---|
| string |
A String object that is the dashboard state.
|
Provides access to the dashboard title settings.
title: DevExpress.Dashboard.Model.DashboardTitle
| Type | Description |
|---|---|
| DashboardTitle |
A DashboardTitle object that contains the dashboard title settings.
|
Disposes of all resources associated with this Dashboard.
dispose(): void
Find an item in the current dashboard by its component name.
findItem(
itemId: string
): DevExpress.Dashboard.Model.DashboardItem
| Name | Type | Description |
|---|---|---|
| itemId | string |
A string value that is a component name of the dashboard item.
|
| Type | Description |
|---|---|
| DashboardItem |
A DashboardItem that corresponds to the specified component name.
|
The following example shows how to get the Grid dashboard item from the current dashboard by its name:
var grid = dashboardControl.dashboard().findItem("gridSalesByState");
For internal use.
getInfo(): DevExpress.Analytics.Utils.ISerializationInfoArray
| Type | Description |
|---|---|
| ISerializationInfoArray |
An array of objects that provide serialization info.
|
getJSON(): any
| Type |
|---|
| any |
Updates the dashboard layout tree according to the current dashboard object model.
rebuildLayout(
clientWidth?: number,
clientHeight?: number
): void
| Name | Type | Description |
|---|---|---|
| clientWidth | number |
A number that specifies the client width of the dashboard.
| | clientHeight | number |
A number that specifies the client height of the dashboard.
|