Repository navigation
Expand file tree
/
Copy pathmulti-level-labels.js
More file actions
111 lines (109 loc) · 3.82 KB
/
Copy pathmulti-level-labels.js
File metadata and controls
111 lines (109 loc) · 3.82 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/**
* Heatmap Multi-Leval-Labels sample
*/
this.default = function () {
var heatmap = new ej.heatmap.HeatMap({
titleSettings: {
text: 'Product wise Monthly sales revenue for a e-commerce website',
textStyle: {
size: '15px',
fontWeight: '500',
fontStyle: 'Normal',
fontFamily: 'Segoe UI'
}
},
xAxis : {
labels: ['Laptop', 'Mobile', 'Gaming', 'Cosmetics', 'Fragrance', 'Watches', 'Handbags', 'Apparel',
'Kitchenware', 'Furniture', 'Home Decor'],
border: {
width: 1,
type: 'Rectangle',
color: '#a19d9d'
},
textStyle: {
color: 'black',
},
multiLevelLabels: [
{
border: { type: 'Rectangle', color: '#a19d9d' },
textStyle: {
color: 'black',
fontWeight: 'Bold'
},
categories: [
{ start: 0, end: 2, text: 'Electronics', },
{ start: 3, end: 4, text: 'Beauty and personal care', },
{ start: 5, end: 7, text: 'Fashion', },
{ start: 8, end: 10, text: 'Household', },
]
},
]
},
yAxis : {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
border: {
width: 0
},
textStyle: {
color: 'black'
},
isInversed: true,
multiLevelLabels: [
{
border: { type: 'Brace', color: '#a19d9d' },
textStyle: {
color: 'black',
fontWeight: 'Bold'
},
categories: [
{ start: 0, end: 2, text: 'Q1' },
{ start: 3, end: 5, text: 'Q2' },
{ start: 6, end: 8, text: 'Q3' },
{ start: 9, end: 11, text: 'Q4' }
]
},
]
},
paletteSettings: {
palette: [{ color: '#F0ADCE' },
{ color: '#19307B' }
],
},
legendSettings: {
visible: false,
},
cellRender: function (args) {
args.displayText = '$ ' + (args.value / 10) + 'K';
},
tooltipRender: function (args) {
args.content = [args.xLabel + ' | ' + args.yLabel + ' : $ ' + (args.value/ 10) + 'K'];
},
cellSettings: {
border: {
width: 0,
},
},
load: function (args) {
var selectedTheme = location.hash.split('/')[1];
selectedTheme = selectedTheme ? selectedTheme : 'Material';
args.heatmap.theme = (selectedTheme .charAt(0).toUpperCase() + selectedTheme .slice(1));
selectedTheme = selectedTheme.toLowerCase();
if(selectedTheme === 'highcontrast')
{
args.heatmap.xAxis.textStyle.color = 'White';
args.heatmap.yAxis.textStyle.color = 'White';
args.heatmap.xAxis.multiLevelLabels[0].textStyle.color = 'White';
args.heatmap.yAxis.multiLevelLabels[0].textStyle.color = 'White';
}
else
{
args.heatmap.xAxis.textStyle.color = 'Black';
args.heatmap.yAxis.textStyle.color = 'Black';
args.heatmap.xAxis.multiLevelLabels[0].textStyle.color = 'Black';
args.heatmap.yAxis.multiLevelLabels[0].textStyle.color = 'Black';
}
},
dataSource: window.multiLevelLabelData
});
heatmap.appendTo('#container');
};