Repository navigation
Expand file tree
/
Copy pathlegend.js
More file actions
59 lines (57 loc) · 2.07 KB
/
Copy pathlegend.js
File metadata and controls
59 lines (57 loc) · 2.07 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
this.default = function () {
var heatmap = new ej.heatmap.HeatMap({
titleSettings: {
text: 'Hourly Weather Forecast (in Celsius)',
textStyle: {
size: '15px',
fontWeight: '500',
fontStyle: 'Normal',
fontFamily: 'Segoe UI'
}
},
xAxis: {
labels: ['London', 'Berlin', 'Madrid', 'Paris', 'Rome', 'Lisbon', 'Dublin']
},
yAxis: {
labels: ['12AM', '2AM', '4AM', '6AM', '8AM', '10AM', '12PM',
'2PM', '4PM', '6PM', '8PM', '10PM']
},
cellSettings: {
showLabel: false,
format: '{value} C'
},
dataSource: window.legentSampleData,
paletteSettings: {
palette: [{ value: 0, color: '#6EB5D0' },
{ value: 10, color: '#7EDCA2' },
{ value: 19, color: '#DCD57E' },
{ value: 22, color: '#DCD57E' },
]
},
tooltipRender: function (args) {
args.content = [args.xLabel + ' | ' + args.yLabel + ' : ' + args.value + '\xB0 C'];
},
load: function (args) {
var legendTheme = location.hash.split('/')[1];
legendTheme = legendTheme ? legendTheme : 'Material';
args.heatmap.theme = (legendTheme.charAt(0).toUpperCase() + legendTheme.slice(1));
},
legendSettings: {
position: 'Left',
labelFormat: '{value}\xB0 C',
},
});
heatmap.appendTo('#container');
var legentListObj = new ej.dropdowns.DropDownList({
index: 0,
popupHeight: '200px',
change: function () { valueXChange(); }
});
legentListObj.appendTo('#LegendPosition');
function valueXChange() {
heatmap.legendSettings.position = legentListObj.value.toString() === 'Right' ?
'Right' : legentListObj.value.toString() === 'Bottom' ?
'Bottom' : legentListObj.value.toString() === 'Left' ?
'Left' : legentListObj.value.toString() === 'Top' ? 'Top' : null;
}
};