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

Providing Data

  • 4 min to read

This topic describes how to bind filter elements to data using the Dashboard Designer, or directly in code.

The Dashboard Designer allows you to bind various dashboard items to data in a consistent manner (see Binding Dashboard Items to Data in the Designer for details), the only difference being the data sections that these dashboard items comprise.

Binding Overview

All filter elements provide the Dimensions data section, which accepts dimensions used to provide filter values. In code, you can provide the required dimensions using the FilterElementDashboardItem.FilterDimensions property.

To learn about the specifics of binding various filter elements to data, see the table below.

Dashboard Item Data Sections Description
Combo Box ComboBox_ProvidingData The Combo Box filter element can contain several dimensions at the Dimensions data section. In this case, the drop-down list will contain combinations of dimension values.
List Box ListBox_ProvidingData The List Box filter element can contain several dimensions at the Dimensions data section. In this case, the list will contain combinations of dimension values.
Tree View TreeView_ProvidingData The Tree View filter element allows you to display dimension values hierarchically. This can be the set of dimensions with different group intervals (for instance, Year/Quarter/Month) or the set of related dimensions (for instance, geographical data such as continents/countries/cities).


The following example demonstrates how to combine filter elements to a group and bind them to data in code.

In this example, the dashboard contains the ComboBoxDashboardItem, ListBoxDashboardItem and TreeViewDashboardItem combined into a group. These filter elements allow you to apply filtering to a Chart dashboard item by selecting the required values.

Imports System
Imports DevExpress.DashboardCommon
Imports DevExpress.DataAccess.ConnectionParameters
Imports DevExpress.DataAccess.Sql
Imports DevExpress.XtraEditors

Namespace Dashboard_FilterElements_and_Groups
    Partial Public Class Form1
        Inherits XtraForm

        Public Sub New()
            Dim dashboard1 As New Dashboard()

            Dim dataSource As New DashboardSqlDataSource()
            dataSource.ConnectionParameters =
                New XmlFileConnectionParameters("..\..\Data\WebsiteStatisticsData.xml")
            Dim selectQuery As SelectQuery = SelectQueryFluentBuilder.AddTable("Data") _
                                             .SelectColumns("Browser", "BrowserDetails", "Date", "Count") _

            Dim comboBox1 As New ComboBoxDashboardItem()
            comboBox1.Name = "Browser"
            comboBox1.DataSource = dataSource
            comboBox1.DataMember = "Statistics"
            comboBox1.FilterDimensions.Add(New Dimension("Browser"))
            comboBox1.ComboBoxType = ComboBoxDashboardItemType.Checked

            Dim listBox1 As New ListBoxDashboardItem()
            listBox1.Name = "Browser Version"
            listBox1.DataSource = dataSource
            listBox1.DataMember = "Statistics"
            listBox1.FilterDimensions.Add(New Dimension("BrowserDetails"))
            listBox1.InteractivityOptions.IgnoreMasterFilters = False

            Dim treeView1 As New TreeViewDashboardItem()
            treeView1.Name = "Date"
            treeView1.DataSource = dataSource
            treeView1.DataMember = "Statistics"
            treeView1.FilterDimensions.AddRange(New Dimension("Date", DateTimeGroupInterval.Year), _
                                                New Dimension("Date", DateTimeGroupInterval.Quarter))
            treeView1.AutoExpandNodes = True

            Dim group1 As New DashboardItemGroup()
            group1.Name = "Filters"
            group1.InteractivityOptions.IsMasterFilter = True
            group1.AddRange(comboBox1, treeView1, listBox1)

            Dim chart1 As New ChartDashboardItem()
            chart1.Name = "Browser Statistics"
            chart1.DataSource = dataSource
            chart1.DataMember = "Statistics"
            chart1.Arguments.Add(New Dimension("Date", DateTimeGroupInterval.MonthYear))
            chart1.SeriesDimensions.AddRange(New Dimension("Browser"), New Dimension("BrowserDetails"))
            chart1.Panes.Add(New ChartPane())
            Dim salesAmountSeries As New SimpleSeries(SimpleSeriesType.SplineArea)
            salesAmountSeries.Value = New Measure("Count")

            dashboardViewer1.Dashboard = dashboard1
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
            Dim layoutGroup1 As DashboardLayoutGroup =
            layoutGroup1.Orientation = DashboardLayoutGroupOrientation.Vertical
            layoutGroup1.Weight = dashboardViewer1.Dashboard.LayoutRoot.Weight / 5
            dashboardViewer1.SetMasterFilter("comboBoxDashboardItem1", "Internet Explorer")
        End Sub
    End Class
End Namespace
See Also