Repository navigation
Expand file tree
/
Copy pathdata-label.js
More file actions
61 lines (61 loc) · 1.94 KB
/
Copy pathdata-label.js
File metadata and controls
61 lines (61 loc) · 1.94 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
/**
* Datalabel sample
*/
this.default = function () {
var maps = new ej.maps.Maps({
// custom code start
load: function (args) {
var labeltheme = location.hash.split('/')[1];
labeltheme = labeltheme ? labeltheme : 'Material';
args.maps.theme = (labeltheme.charAt(0).toUpperCase() + labeltheme.slice(1));
},
// custom code end
zoomSettings: {
enable: false
},
layers: [
{
dataLabelSettings: {
visible: true,
labelPath: 'name',
smartLabelMode: 'Trim'
},
shapeData: new ej.maps.MapAjax('./src/maps/map-data/usa.json'),
shapeSettings: {
autofill: true
},
tooltipSettings: {
visible: true,
valuePath: 'name'
},
}
]
});
maps.appendTo('#datalabel');
// Code for Property Panel
var intersectaction = new ej.dropdowns.DropDownList({
index: 0,
placeholder: 'Select intersect action',
width: 120,
change: function () {
maps.layers[0].dataLabelSettings.intersectionAction = intersectaction.value;
maps.refresh();
}
});
intersectaction.appendTo('#intersectaction');
var smartlabelmode = new ej.dropdowns.DropDownList({
index: 0,
placeholder: 'Select smartlabel mode',
width: 120,
change: function () {
maps.layers[0].dataLabelSettings.smartLabelMode = smartlabelmode.value;
maps.refresh();
}
});
smartlabelmode.appendTo('#smartlabelmode');
document.getElementById('select').onchange = function () {
var element = (document.getElementById('select'));
maps.layers[0].dataLabelSettings.visible = element.checked;
maps.refresh();
};
};