The requested page is not available for the requested platform. You are viewing the content for Default platform.

Manage Dashboard State

A dashboard state describes the changes resulting from end-user interaction. The dashboard state is the DashboardState class instance and can contain the following objects:

Dashboard State Object

API

Selected master filter values for dashboard items.

DashboardItemState.MasterFilterValues

Current drill-down levels for dashboard items.

DashboardItemState.DrillDownValues

Selected Range Filter interval.

DashboardItemState.RangeFilterState

Selected dashboard item layers for the following items:

DashboardItemState.SelectedLayerIndex

A selected tab page.

DashboardItemState.TabPageName

Dashboard parameter values.

DashboardState.Parameters

Use the DashboardState.Items property to get access to the dashboard item state collection.

The DashboardViewer provides the following API to manage the dashboard state:

Member Description
DashboardViewer.GetDashboardState Gets the current dashboard state.
DashboardViewer.SetDashboardState Applies the dashboard state to the loaded dashboard.
DashboardViewer.SetInitialDashboardState Allows you to specify the initial dashboard state when loading a dashboard.

Example

The following code snippet shows how to set a dashboard state for WinForms Dashboard Viewer in code:

using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
using System.Collections.Generic;

// ...
public void ApplyDashboardState(DashboardViewer dashboardViewer) {
    DashboardState state = new DashboardState();
    // Sets a range for a Range Filter.
    state.Items.Add(new DashboardItemState("rangeFilterDashboardItem1") { 
    RangeFilterState = new RangeFilterState(new RangeFilterSelection(new DateTime(2015, 1, 1), new DateTime(2017, 1, 1))) 
    });
    // Specifies master filter and drill-down values.
    state.Items.Add(new DashboardItemState("gridDashboardItem1") {
        MasterFilterValues = new List<object[]>() { new object[] { "Cycling Cap" } },
        DrillDownValues = new List<object>() { "Clothing" },
    });
    // Sets a dashboard item layer.
    state.Items.Add(new DashboardItemState("choroplethMapDashboardItem1") {
        SelectedLayerIndex = 1
    });
    // Specifies a default tab page.
    state.Items.Add(new DashboardItemState("tabContainer1") {
        TabPageName = "salesTabPage"
    });
    // Defines a dashboard parameter value.
    state.Parameters.Add(new DashboardParameterState() {
        Name = "categoryParam",
        Value = "Beverages",
        Type = typeof(string)
    });

    dashboardViewer.SetDashboardState(state);
}