HTMLcopy
1
<div id="container"></div>
CSScopy
8
1
html,
2
body,
3
#container {
4
width: 100%;
5
height: 100%;
6
margin: 0;
7
padding: 0;
8
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
// set output locale
3
anychart.format.outputLocale('ne-np');
4
anychart.format.outputDateTimeFormat('dd MMMM yyyy'); // Like '01 January 2015'
5
6
// The data used in this sample can be obtained from the CDN
7
// https://cdn.anychart.com/samples/maps-general-features/map-with-nepal-localization/data.js
8
// create data set
9
var dataSet = anychart.data.set(getData()); // eslint-disable-line no-undef
10
11
// create map chart
12
var map = anychart.map();
13
14
map.unboundRegions().enabled(true).fill('#E1E1E1').stroke('#D2D2D2');
15
16
// set geodata using https://cdn.anychart.com/geodata/latest/countries/australia/australia.js
17
map.geoData('anychart.maps.nepal');
18
map
19
.title()
20
.enabled(true)
21
.useHtml(true)
22
.padding([20, 0, 0, 0])
23
.text(
24
'Eight-thousanders of ' +
25
'Nepal with first-ascent date. <br/> पहिलो विजय को मिति संग आठ-नेपाल।'
26
);
27
28
map
29
.padding([0, 30])
30
// set chart bubble settings
31
.maxBubbleSize(7)
32
.minBubbleSize(3);
33
34
// create bubble series
35
var series = map.bubble(dataSet);
36
series
37
.selectionMode('none')
38
.fill('#1976d2 0.6')
39
.stroke('1 #1976d2 0.9');
40
series
41
.labels()
42
.enabled(true)
43
.anchor('right-center')
44
.position('left')
45
.offsetX(3)
46
.padding(0)
47
.fontColor('#212121')
48
.useHtml(true)
49
.format(function () {
50
return anychart.format.dateTime(this.getData('ascent'));
51
});
52
series.hovered().labels().fontWeight('bold');
53
54
// set series tooltip settings
55
series
56
.tooltip()
57
.useHtml(true)
58
.fontColor('#7c868e')
59
.width(250)
60
.padding([8, 13, 10, 13])
61
.titleFormat(function () {
62
var spanForValue =
63
' (<span style="color: #545f69; font-size: 12px; font-weight: bold">';
64
return (
65
this.getData('name') +
66
spanForValue +
67
this.getData('size') +
68
'</span>m</strong>)'
69
);
70
})
71
.format(function () {
72
return (
73
'First Ascent: <span style="color: #545f69; font-size: 12px">' +
74
anychart.format.dateTime(this.getData('ascent')) +
75
'</span></strong><br/>' +
76
'First Summiters: <span style="color: #545f69; font-size: 12px">' +
77
this.getData('summiters') +
78
'</span></strong>'
79
);
80
});
81
82
series
83
.tooltip()
84
.background()
85
.enabled(true)
86
.fill('#fff')
87
.stroke('#c1c1c1')
88
.corners(3)
89
.cornerType('ROUND');
90
91
series.tooltip().title().useHtml(true).fontColor('#7c868e');
92
93
// set series geo id field settings
94
series.geoIdField('code_hasc');
95
96
// create zoom controls
97
var zoomController = anychart.ui.zoom();
98
zoomController.render(map);
99
100
// set container id for the chart
101
map.container('container');
102
103
// initiate chart drawing
104
map.draw();
105
});