Back to Devexpress

DashboardViewer.GetAvailableFilterValuesAsync(String) Method

dashboard-devexpress-dot-dashboardwin-dot-dashboardviewer-dot-getavailablefiltervaluesasync-x28-system-dot-string-x29.md

latest4.8 KB
Original Source

DashboardViewer.GetAvailableFilterValuesAsync(String) Method

Gets the data (axis point tuples) that identifies selectable elements in the current state of the master filter item.

Namespace : DevExpress.DashboardWin

Assembly : DevExpress.Dashboard.v25.2.Win.dll

NuGet Package : DevExpress.Win.Dashboard

Declaration

csharp
public Task<IList<AxisPointTuple>> GetAvailableFilterValuesAsync(
    string dashboardItemName
)
vb
Public Function GetAvailableFilterValuesAsync(
    dashboardItemName As String
) As Task(Of IList(Of AxisPointTuple))

Parameters

NameTypeDescription
dashboardItemNameString

A String that is the component name of the master filter item.

|

Returns

TypeDescription
Task<IList<AxisPointTuple>>

The task object that is the asynchronous operation to get a list of AxisPointTuple objects.

|

Example

This example demonstrates how to work in asynchronous mode to get filter values, set the master filter and perform an asynchronous task when the dashboard is loaded for the first time.

Click Random Filter to get available filters and apply a random filter asynchronously.

csharp
using DevExpress.DashboardCommon.ViewerData;
using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RandomFilterExample
{
    public partial class ViewerForm1 : XtraForm {
        public ViewerForm1() {
            InitializeComponent();
            dashboardViewer1.Initialized += OnDashboardViewerInitialized;

        }
        async void OnMouseClick(object sender, MouseEventArgs e) {
            await RandomFilter();
        }
        async Task RandomFilter() {
            string itemName = "choroplethMapDashboardItem1";
            IList<AxisPointTuple> filters = await dashboardViewer1.GetAvailableFilterValuesAsync(itemName);
            Random r = new Random();
            int index = r.Next(0, filters.Count - 1);
            await dashboardViewer1.SetMasterFilterAsync(itemName, filters[index]);
        }

        async void OnDashboardViewerInitialized(object sender, EventArgs e) {
            await RandomFilter();
        }
    }
}
vb
Imports DevExpress.DashboardCommon.ViewerData
Imports DevExpress.XtraEditors
Imports System
Imports System.Collections.Generic
Imports System.Threading.Tasks
Imports System.Windows.Forms

Namespace RandomFilterExample
    Partial Public Class ViewerForm1
        Inherits XtraForm

        Public Sub New()
            InitializeComponent()
            AddHandler dashboardViewer1.Initialized, AddressOf OnDashboardViewerInitialized

        End Sub
        Private Async Overloads Sub OnMouseClick(ByVal sender As Object, ByVal e As MouseEventArgs) Handles simpleButton1.MouseClick
            Await RandomFilter()
        End Sub
        Private Async Function RandomFilter() As Task
            Dim itemName As String = "choroplethMapDashboardItem1"
            Dim filters As IList(Of AxisPointTuple) = Await dashboardViewer1.GetAvailableFilterValuesAsync(itemName)
            Dim r As New Random()
            Dim index As Integer = r.Next(0, filters.Count - 1)
            Await dashboardViewer1.SetMasterFilterAsync(itemName, filters(index))
        End Function

        Private Async Sub OnDashboardViewerInitialized(ByVal sender As Object, ByVal e As EventArgs)
            Await RandomFilter()
        End Sub
    End Class
End Namespace

Implements

GetAvailableFilterValuesAsync(String)

See Also

Asynchronous Mode

DashboardViewer Class

DashboardViewer Members

DevExpress.DashboardWin Namespace