ASPxClientDashboardItemVisualInteractivityEventArgs Class
Provides data for the ASPxClientDashboard.ItemVisualInteractivity event.
Declaration
declare class ASPxClientDashboardItemVisualInteractivityEventArgs extends ASPxClientEventArgs
Remarks
The ASPxClientDashboard.ItemVisualInteractivity 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 disabled master filtering. Visual interactivity is enabled for master filter items by default. The ASPxClientDashboard fires this event when master filtering is applied to the current dashboard item or you drill down to this dashboard item.
Use the ASPxClientDashboardItemVisualInteractivityEventArgs.ItemName event parameter to obtain the name of the dashboard item for which the event was raised. The ASPxClientDashboardItemVisualInteractivityEventArgs.SetTargetAxes method allows you to specify data axes used to perform custom interactivity actions (selection of grid rows, selection and highlighting of chart series points, etc.).
To specify the selection mode and enable highlighting, use the ASPxClientDashboardItemVisualInteractivityEventArgs.SetSelectionMode and ASPxClientDashboardItemVisualInteractivityEventArgs.EnableHighlighting methods respectively. The ASPxClientDashboardItemVisualInteractivityEventArgs.SetDefaultSelection method provides the capability to specify the default selection for the current dashboard item.
After the selection is changed, the ASPxClientDashboard.ItemSelectionChanged event is raised. Its ASPxClientDashboardItemSelectionChangedEventArgs.GetCurrentSelection method 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 |
---|---|---|---|
Note
Note that the Grid dashboard item does not support custom interactivity when Cell Merging is enabled.
Example
The Web Dashboard allows you to add a custom interactivity to dashboards using the ASPxClientDashboard.ItemVisualInteractivity event. This example demonstrates the following capabilities.
- The Grid dashboard item allows you to select categories and visualize a corresponding product quantity using the dxBarGauge widget. Note that the hidden ‘Quantity’ measure is used to pass the required values to the client.
- The Chart dashboard item highlights bars corresponding to a hovered argument value.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/aspxdashboard-how-to-add-custom-interactivity-to-a-dashboard-t495562.
var defaultAxis = DashboardDataAxisNames.DefaultAxis,
argumentAxis = DashboardDataAxisNames.ChartArgumentAxis;
function addCustomInteractivity(args) {
if (args.ItemName == "gridDashboardItem1") {
args.SetTargetAxes([defaultAxis]);
args.SetSelectionMode("Multiple");
}
if (args.ItemName == "chartDashboardItem1") {
args.SetTargetAxes([argumentAxis]);
args.EnableHighlighting(true);
}
}
function createControls() {
$('#barGauge').dxBarGauge({
startValue: 0,
endValue: 10000,
values: getAllValues(),
label: {
format: 'fixedPoint',
precision: 0
}
});
}
function applyCurrentSelection(args) {
var quantityValues = [];
if (args.ItemName == "gridDashboardItem1" & args.GetCurrentSelection().length != 0) {
var clientData = webViewer.GetItemData("gridDashboardItem1");
for (var i = 0; i < args.GetCurrentSelection().length; i++) {
var currentTuple = args.GetCurrentSelection()[i],
slice = clientData.GetSlice(currentTuple.GetAxisPoint()),
quantity = (slice.GetMeasureValue(clientData.GetMeasures()[0].Id)).GetValue();
quantityValues.push(quantity);
}
} else {
quantityValues = getAllValues();
}
$('#barGauge').data("dxBarGauge").values(quantityValues);
}
function getAllValues() {
var quantityValues = [],
clientData = webViewer.GetItemData("gridDashboardItem1");
for (var i = 0; i < clientData.GetAxis(defaultAxis).GetPoints().length; i++) {
var slice = clientData.GetSlice(clientData.GetAxis(defaultAxis).GetPoints()[i]),
quantity = (slice.GetMeasureValue(clientData.GetMeasures()[0].Id)).GetValue();
quantityValues.push(quantity);
}
return quantityValues;
}
Inherited Members
Inheritance
Properties
ItemName Property
Gets the component name of the dashboard item for which the event was raised.
Declaration
ItemName: string
Property Value
Type | Description |
---|---|
string | A string value that is the component name of the dashboard item. |
Methods
EnableHighlighting(enableHighlighting) Method
Enables highlighting for the current dashboard item.
Declaration
EnableHighlighting(
enableHighlighting: boolean
): void
Parameters
Name | Type | Description |
---|---|---|
enableHighlighting | boolean | true, to enable highlighting; otherwise, false. |
GetDefaultSelection Method
Gets the default selection for the current dashboard item.
Declaration
GetDefaultSelection(): ASPxClientDashboardItemDataAxisPointTuple[]
Returns
Type | Description |
---|---|
ASPxClientDashboardItemDataAxisPointTuple[] | An array of ASPxClientDashboardItemDataAxisPointTuple objects that are the axis point tuples identifying the selected elements. |
GetSelectionMode Method
Gets the selection mode for dashboard item elements.
Declaration
GetSelectionMode(): string
Returns
Type | Description |
---|---|
string | A DashboardSelectionMode value that specifies the selection mode. |
Remarks
Use the ASPxClientDashboardItemVisualInteractivityEventArgs.SetSelectionMode property to set the selection mode.
GetTargetAxes Method
Gets data axes used to perform custom interactivity actions.
Declaration
GetTargetAxes(): string[]
Returns
Type | Description |
---|---|
string[] | An array of String objects that are the names of data axes. |
IsHighlightingEnabled Method
Returns whether highlighting is enabled for the current dashboard item.
Declaration
IsHighlightingEnabled(): boolean
Returns
Type | Description |
---|---|
boolean | true, if highlighting is enabled; otherwise, false. |
SetDefaultSelection(values) Method
Sets the default selection for the current dashboard item.
Declaration
SetDefaultSelection(
values: ASPxClientDashboardItemDataAxisPointTuple[]
): void
Parameters
Name | Type | Description |
---|---|---|
values | ASPxClientDashboardItemDataAxisPointTuple[] | An array of ASPxClientDashboardItemDataAxisPointTuple objects specifying axis point tuples used to select default elements. |
SetSelectionMode(selectionMode) Method
Sets the selection mode for dashboard item elements.
Declaration
SetSelectionMode(
selectionMode: string
): void
Parameters
Name | Type | Description |
---|---|---|
selectionMode | string | A DashboardSelectionMode value that specifies the selection mode. |
Remarks
See ItemVisualInteractivityEventArgs.setSelectionMode for more information about supported selection modes.
Use the ASPxClientDashboardItemVisualInteractivityEventArgs.GetSelectionMode property to get the selection mode.
SetTargetAxes(targetAxes) Method
Sets data axes used to perform custom interactivity actions.
Declaration
SetTargetAxes(
targetAxes: string[]
): void
Parameters
Name | Type | Description |
---|---|---|
targetAxes | string[] | An array of String objects that specify names of data axes. |