HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
// This sample uses 3rd party Proj4js JavaScript library to transform coordinates
3
// See https://docs.anychart.com/Maps/Map_Projections to learn more.
4
5
var stage = anychart.graphics.create("container");
6
7
var firstDataSet = anychart.data.set([
8
{id: "AU.CT", value: 15, title: "Australian Capital Territory"},
9
{id: "AU.VI", value: 23, title: "Victoria"},
10
{id: "AU.WA", value: 86, title: "Western Australia"},
11
{id: "AU.QL", value: 16, title: "Queensland"},
12
{id: "AU.NS", value: 32, title: "New South Wales"},
13
{id: "AU.NT", value: 64, title: "Northern Territory"},
14
{id: "AU.TS", value: 28, title: "Tasmania"},
15
{id: "AU.SA", value: 45, title: "South Australian"}
16
]);
17
18
var secondDataSet = anychart.data.set([
19
{id: "AU.CT", value: 15, title: "Australian Capital Territory"},
20
{id: "AU.VI", value: 23, title: "Victoria"},
21
{id: "AU.WA", value: 86, title: "Western Australia"},
22
{id: "AU.QL", value: 16, title: "Queensland"},
23
{id: "AU.NS", value: 32, title: "New South Wales"},
24
{id: "AU.NT", value: 64, title: "Northern Territory"},
25
{id: "AU.TS", value: 28, title: "Tasmania"},
26
{id: "AU.SA", value: 45, title: "South Australian"}
27
]);
28
29
var firstDataSetForSeries = firstDataSet.mapAs({id: "id"});
30
31
var firstAustraliaMap = anychart.map();
32
firstAustraliaMap.bounds(0, 0, "50%", "100%");
33
firstAustraliaMap.geoData(anychart.maps.australia);
34
35
var series = firstAustraliaMap.choropleth(firstDataSetForSeries);
36
series.hatchFill("backwardDiagonal", "#FFFFFF", 1.5, 50);
37
38
firstAustraliaMap.container(stage);
39
firstAustraliaMap.draw();
40
41
var secondDataSetForSeries = secondDataSet.mapAs({id: "id"});
42
43
var secondAustraliaMap = anychart.map();
44
secondAustraliaMap.bounds("50%", 0, "50%", "100%");
45
secondAustraliaMap.geoData(anychart.maps.australia);
46
47
var secondSeries = secondAustraliaMap.choropleth(secondDataSetForSeries);
48
49
var color = anychart.scales.linearColor("#8BC34A");
50
secondSeries.colorScale(color);
51
52
// Get hatch fill.
53
var hatchFill = series.hatchFill();
54
55
secondSeries.hatchFill(hatchFill);
56
57
secondAustraliaMap.container(stage);
58
secondAustraliaMap.draw();
59
60
var title = anychart.standalones.title();
61
title.text("Get amd use hatch fill");
62
title.container(stage);
63
title.draw();
64
});