anychart.onDocumentReady(function () {
// The data used in this sample can be obtained from the CDN
// https://cdn.anychart.com/samples/maps-point-maps-dot-maps/starbucks-in-china/data.json
anychart.data.loadJsonFile('https://cdn.anychart.com/samples/maps-point-maps-dot-maps/starbucks-in-china/data.json', function (data) {
// creates map chart
var map = anychart.map();
map.scale().gap(0.05);
map.credits()
.enabled(true)
.url('https://opendata.socrata.com/Business/All-Starbucks-Locations-in-the-World/xy4y-c4mk')
.text('Data source: https://opendata.socrata.com')
.logoSrc('https://opendata.socrata.com/stylesheets/images/common/favicon.ico');
map.unboundRegions()
.enabled(true)
.fill('#E1E1E1')
.stroke('#D2D2D2');
// sets geodata
map.geoData('anychart.maps.china');
// sets Chart Title
map.title()
.enabled(true)
.useHtml(true)
.padding([0, 0, 10, 0])
.text('Starbucks Coffeehouses in China<br/>' +
'<span style="color:#929292; font-size: 12px;">According to opendata.socrata.com</span>');
// sets marker series for airports
var series = map.marker(anychart.data.set(data));
// sets Tooltip for series
series.tooltip()
.useHtml(true)
.padding([8, 13, 10, 13])
.title(false)
.separator(false)
.fontSize(14)
.format(function () {
return '<span>' + this.getData('name') + '</span><br/>' +
'<span style="font-size: 12px; color: #E1E1E1">City: ' +
this.getData('address') + '</span>';
});
// sets settings for marker-airports series
series.size(4)
.stroke('2 #fff')
.fill('#007042')
.labels(false)
.selectionMode('none');
series.hovered()
.size(9)
.fill('#005734')
.stroke('3 #fff');
// create zoom controls
var zoomController = anychart.ui.zoom();
zoomController.render(map);
// sets container id for the chart
map.container('container');
// initiates chart drawing
map.draw();
});
});