DashboardViewer.DashboardItemVisualInteractivity Event

Allows you to provide custom visual interactivity for data-bound dashboard items that support element selection and highlighting.

Namespace: DevExpress.DashboardWin

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

Declaration

public event DashboardItemVisualInteractivityEventHandler DashboardItemVisualInteractivity
Public Event DashboardItemVisualInteractivity As DashboardItemVisualInteractivityEventHandler
Property Description
DashboardItemName

Gets the component name of the dashboard item for which the event was raised.

Data

Gets client data visualized within the dashboard item.

EnableHighlighting

Gets or sets whether to enable highlighting for the current dashboard item.

SelectionMode

Gets or sets the selection mode for dashboard item elements.

TargetAxes

Gets or sets data axes used to perform custom interactivity actions.

The DashboardItemVisualInteractivity event allows you to provide custom visual interactivity for data-bound dashboard items that support element selection and highlighting. This event is raised for dashboard items with master filtering disabled. Visual interactivity for master filter items is enabled by default. The DashboardViewer also fires this event when master filtering is applied to the current dashboard item.

Note

Note that the DashboardItemVisualInteractivity event is raised on the bottommost drill-down level for dashboard items with drill-down enabled.

Use the DashboardItemVisualInteractivityEventArgs.DashboardItemName event parameter to obtain the name of the dashboard item for which the event was raised.

The DashboardItemVisualInteractivityEventArgs.TargetAxes property allows you to specify data axes used to perform custom interactivity actions (grid row selection, selecting and highlighting chart series points, etc.). The DashboardItemVisualInteractivityEventArgs.Data event parameter returns the MultiDimensionalData object whose members allow you to obtain the available data axes.

To specify the selection mode and manage highlighting, use the DashboardItemVisualInteractivityEventArgs.SelectionMode and DashboardItemVisualInteractivityEventArgs.EnableHighlighting properties respectively. The DashboardItemVisualInteractivityEventArgs.SetDefaultSelection method provides the capability to specify the current dashboard item's default selection.

The DashboardViewer.DashboardItemSelectionChanged event is raised after the selection changes. Its DashboardItemSelectionChangedEventArgs.CurrentSelection parameter returns the selected elements.

The following table lists possible target axes for each dashboard item and supported interactivity capabilities:

Dashboard Item

Target Axes

Selection

Highlighting

GridDashboardItem

DashboardDataAxisNames.DefaultAxis

Dashboard_GreenTick

ChartDashboardItem

DashboardDataAxisNames.ChartArgumentAxis

DashboardDataAxisNames.ChartSeriesAxis

Dashboard_GreenTick

Dashboard_GreenTick

ScatterChartDashboardItem

DashboardDataAxisNames.ChartArgumentAxis

Dashboard_GreenTick

Dashboard_GreenTick

PieDashboardItem

DashboardDataAxisNames.ChartArgumentAxis

DashboardDataAxisNames.ChartSeriesAxis

Dashboard_GreenTick

Dashboard_GreenTick

CardDashboardItem

DashboardDataAxisNames.DefaultAxis

Dashboard_GreenTick

Dashboard_GreenTick

GaugeDashboardItem

DashboardDataAxisNames.DefaultAxis

Dashboard_GreenTick

Dashboard_GreenTick

MapDashboardItem

DashboardDataAxisNames.DefaultAxis

Dashboard_GreenTick

TreemapDashboardItem

DashboardDataAxisNames.DefaultAxis

Dashboard_GreenTick

Dashboard_GreenTick

Note

Note that the Grid dashboard item does not support custom interactivity when Cell Merging is enabled.

Examples

The WinForms Dashboard Viewer allows you to add a custom interactivity to dashboards using the DashboardViewer.DashboardItemVisualInteractivity event.

This example demonstrates the following capabilities:

  • The Grid dashboard item allows you to select categories and filter an external PivotGridControl according to selected records.
  • The ChartChart dashboard item highlights a bar under the mouse pointer and allows you to obtain underlying data by clicking this bar.
using DevExpress.DashboardWin;
using DevExpress.XtraEditors;
using DevExpress.XtraPivotGrid;
using DevExpress.DashboardCommon;
using System.Windows.Forms;
using DevExpress.DashboardCommon.ViewerData;
using DevExpress.DataAccess;
namespace Dashboard_CustomVisualInteractivity {
    public partial class Form1 : XtraForm {
        public Form1() {
            InitializeComponent();
            this.salesPersonTableAdapter.Fill(this.nwindDataSet.SalesPerson);

            dashboardViewer1.LoadDashboard(@"..\..\Data\Dashboard.xml");
        }

        private void dashboardViewer1_DashboardItemVisualInteractivity(object sender, 
            DashboardItemVisualInteractivityEventArgs e) {
            if (e.DashboardItemName == "gridDashboardItem1") {
                e.SelectionMode = DashboardSelectionMode.Multiple;
                e.SetDefaultSelection(e.Data.GetAxisPoints(DashboardDataAxisNames.DefaultAxis)[0]);
            }
            if (e.DashboardItemName == "chartDashboardItem1") {
                e.TargetAxes.Add(DashboardDataAxisNames.ChartArgumentAxis);
                e.TargetAxes.Add(DashboardDataAxisNames.ChartSeriesAxis);
                e.EnableHighlighting = true;
            }
        }

        private void dashboardViewer1_DashboardItemSelectionChanged(object sender, 
            DashboardItemSelectionChangedEventArgs e) {
            pivotGridControl1.BeginUpdate();
            fieldCategoryName1.FilterValues.FilterType = PivotFilterType.Included;
            fieldCategoryName1.FilterValues.Clear();
            foreach (AxisPointTuple selectedElement in e.CurrentSelection) {
                string category = selectedElement.GetAxisPoint().DimensionValue.Value.ToString();
                fieldCategoryName1.FilterValues.Add(category);
            }
            pivotGridControl1.EndUpdate();
        }

        private void dashboardViewer1_DashboardItemClick(object sender, 
            DashboardItemMouseActionEventArgs e) {
            if (e.DashboardItemName == "chartDashboardItem1" && e.GetAxisPoint() != null) {
                XtraForm form = new XtraForm();
                form.Text = e.GetAxisPoint(DashboardDataAxisNames.ChartArgumentAxis).
                    DimensionValue.Value.ToString() + " - " +
                    e.GetAxisPoint(DashboardDataAxisNames.ChartSeriesAxis).
                    DimensionValue.Value.ToString();
                DataGrid grid = new DataGrid();
                grid.Parent = form; grid.Dock = DockStyle.Fill;
                grid.DataSource = e.GetUnderlyingData();
                form.ShowDialog();
                form.Dispose();
            }
        }

        private void dashboardViewer1_DataLoading(object sender, DataLoadingEventArgs e) {
            if (e.DataSourceComponentName == "dataSource1") {
                e.Data = this.nwindDataSet.SalesPerson;
            }
        }
    }
}

See Also