-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWidgetsCustomization.js
56 lines (56 loc) · 2.01 KB
/
WidgetsCustomization.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
function onBeforeRender(s, e) {
var dashboardControl = s.GetDashboardControl();
var viewerApiExtension = dashboardControl.findExtension('viewerApi');
if (viewerApiExtension) {
viewerApiExtension.on('itemWidgetOptionsPrepared', customizeWidgetOptions);
viewerApiExtension.on('itemWidgetUpdated', customizeWidget);
viewerApiExtension.on('itemWidgetCreated', customizeWidget);
};
}
function customizeWidgetOptions(e) {
if (e.dashboardItem instanceof DevExpress.Dashboard.Model.GridItem) {
e.options.hoverStateEnabled = true
};
if (e.dashboardItem instanceof DevExpress.Dashboard.Model.ChartItem) {
e.options.tooltip.enabled = false;
e.options.animation = {
...e.options.animation,
enabled: true,
duration: 1000
};
e.options.onArgumentAxisClick = function (info) {
info.component.getAllSeries()[0].getPointsByArg(info.argument)[0].showTooltip();
}
};
if (e.dashboardItem instanceof DevExpress.Dashboard.Model.PieItem) {
e.options.legend = {
...e.options.legend,
visible: true,
border: {
...e.options.legend.border,
visible: true
}
};
e.options.animation = {
...e.options.animation,
enabled: true,
duration: 1000
};
}
if (e.dashboardItem instanceof DevExpress.Dashboard.Model.GaugeItem) {
var gaugesCollection = e.dashboardItem.gauges();
gaugesCollection.forEach(element => {
if (element.actualValue().dataMember() == 'Extended Price') {
e.options.scale.tick.tickInterval = 1000
}
});
}
}
function customizeWidget(e) {
if (e.dashboardItem instanceof DevExpress.Dashboard.Model.GaugeItem) {
var gaugesCollection = e.getWidget();
gaugesCollection.forEach(element => {
element.option('scale.label.font.weight', '600');
});
}
}