HTMLcopy
1
<script src="https://cdn.anychart.com/releases/8.11.0/js/anychart-core.min.js"></script>
2
<script src="https://cdn.anychart.com/releases/8.11.0/js/anychart-map.min.js"></script>
3
<script src="https://cdn.anychart.com/releases/8.11.0/geodata/countries/united_states_of_america/united_states_of_america.js"></script>
4
<script src="https://cdn.anychart.com/releases/8.11.0/js/anychart-data-adapter.min.js"></script>
5
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js"></script>
6
<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
anychart.data.loadJsonFile(
3
"https://gist.githubusercontent.com/shacheeswadia/eead370d79e0f20df5148b79b6887393/raw/fba29e3dcf1806cab770e845546a136a924cf1d5/dataBubbleMap2.json",
4
function (data) {
5
6
// create a map chart
7
let map = anychart.map();
8
9
// add the u.s. geodata
10
map.geoData("anychart.maps.united_states_of_america");
11
12
// create a bubble series
13
let series = map.bubble(
14
anychart.data.set(data).mapAs({
15
size: "Petrol"
16
})
17
);
18
19
// enable the series labels
20
series
21
.labels()
22
.enabled(true);
23
24
// set the map's title
25
map.title("Gasoline Prices in the United States in July 2022");
26
27
// set the container id
28
map.container("container");
29
30
// initiate the map drawing
31
map.draw();
32
33
}
34
);
35
});