DashboardViewer.GetItemDataAsync(String) Method
Obtains the displayed data for the specified dashboard item asynchronously.
Namespace: DevExpress.DashboardWin
Assembly: DevExpress.Dashboard.v20.1.Win.dll
NuGet Packages: DevExpress.Win.Dashboard, DevExpress.WindowsDesktop.Win.Dashboard
Declaration
Parameters
Name | Type | Description |
---|---|---|
dashboardItemName | String | A String that specifies the component name of the dashboard item. |
Returns
Type | Description |
---|---|
Task<MultiDimensionalData> | The task object that is the asynchronous operation to get the data visualized in the dashboard item. |
Example
This example demonstrates how to get the data displayed in the dashboard item asynchronously when the dashboard is loaded.
Note
Example on GitHub: How to Get Dashboard Item Data Asynchronously
using DevExpress.DashboardCommon;
using DevExpress.XtraEditors;
using System;
using System.Threading.Tasks;
namespace DataCounterExample
{
public partial class ViewerForm1 : XtraForm {
public ViewerForm1() {
InitializeComponent();
dashboardViewer1.Initialized += OnDashboardViewerInitialized;
dashboardViewer1.MasterFilterSet += OnDashboardViewerMasterFilterSet;
dashboardViewer1.MasterFilterCleared += OnDashboardViewerMasterFilterCleared;
}
async void OnDashboardViewerInitialized(object sender, EventArgs e) {
simpleLabelItem1.Text = await GetLabelText("choroplethMapDashboardItem1", "Map");
simpleLabelItem2.Text = await GetLabelText("gridDashboardItem1", "Grid");
}
async void OnDashboardViewerMasterFilterSet(object sender, MasterFilterSetEventArgs e) {
simpleLabelItem2.Text = await GetLabelText("gridDashboardItem1", "Grid");
}
async void OnDashboardViewerMasterFilterCleared(object sender, MasterFilterClearedEventArgs e) {
simpleLabelItem2.Text = await GetLabelText("gridDashboardItem1", "Grid");
}
async Task<string> GetLabelText(string itemName, string itemCaption) {
var data = await dashboardViewer1.GetItemDataAsync(itemName);
int count = data.GetAxisPoints(data.GetAxisNames()[0]).Count;
return string.Format("{0}: {1}", itemCaption, count);
}
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetItemDataAsync(String) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.