-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.jsx
More file actions
78 lines (74 loc) · 2.57 KB
/
App.jsx
File metadata and controls
78 lines (74 loc) · 2.57 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import React from 'react';
import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';
import '@devexpress/analytics-core/dist/css/dx-analytics.common.css';
import '@devexpress/analytics-core/dist/css/dx-analytics.light.css';
import '@devexpress/analytics-core/dist/css/dx-querybuilder.css';
import 'devexpress-dashboard/dist/css/dx-dashboard.light.css';
import DashboardControl, {Extensions, ViewerApi } from 'devexpress-dashboard-react';
import { GridItem, ChartItem, PieItem, GaugeItem} from 'devexpress-dashboard/model';
function customizeWidgetOptions(e) {
if (e.dashboardItem instanceof GridItem) {
e.options.hoverStateEnabled = true
}
if (e.dashboardItem instanceof 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 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 GaugeItem) {
var gaugesCollection = e.dashboardItem.gauges();
gaugesCollection.forEach(element => {
if (element.actualValue().dataMember() === 'UnitPrice') {
e.options.scale.tick.tickInterval = 50
}
});
};
}
function customizeWidget(e) {
if (e.dashboardItem instanceof GaugeItem) {
var gaugesCollection = e.getWidget();
gaugesCollection.forEach(element => {
element.option('scale.label.font.weight', '600');
});
}
}
function App() {
return (
<div style={{ position : 'absolute', top : '0px', left: '0px', right : '0px', bottom: '0px' }}>
<DashboardControl style={{ height: '100%' }}
endpoint="http://localhost:5000/api/dashboard"
workingMode="Viewer">
<Extensions>
<ViewerApi
onItemWidgetOptionsPrepared={customizeWidgetOptions}
onItemWidgetUpdated={customizeWidget}
onItemWidgetCreated={customizeWidget}>
</ViewerApi>
</Extensions>
</DashboardControl>
</div>
);
}
export default App;