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.NT", value: 64, title: "Northern Territory"},
24
{id: "AU.TS", value: 28, title: "Tasmania"},
25
{id: "AU.SA", value: 45, title: "South Australian"}
26
]);
27
28
var firstDataSetForSeries = firstDataSet.mapAs({id: "id"});
29
30
var firstAustraliaMap = anychart.map();
31
firstAustraliaMap.bounds(0, 0, "50%", "100%");
32
firstAustraliaMap.geoData(anychart.maps.australia);
33
34
var series = firstAustraliaMap.choropleth(firstDataSetForSeries);
35
series.hoverHatchFill("backwardDiagonal", "#FFFFFF", 1.5, 50);
36
37
firstAustraliaMap.container(stage);
38
firstAustraliaMap.draw();
39
40
var secondDataSetForSeries = secondDataSet.mapAs({id: "id"});
41
42
var secondAustraliaMap = anychart.map();
43
secondAustraliaMap.bounds("50%", 0, "50%", "100%");
44
secondAustraliaMap.geoData(anychart.maps.australia);
45
46
var secondSeries = secondAustraliaMap.choropleth(secondDataSetForSeries);
47
48
var color = anychart.scales.linearColor("#8BC34A");
49
secondSeries.colorScale(color);
50
51
// Get hatch fill in hover mode.
52
var hoverHatchFill = series.hoverHatchFill();
53
54
secondSeries.hoverHatchFill(hoverHatchFill);
55
56
// Hovers series.
57
secondSeries.hover();
58
series.hover();
59
60
secondAustraliaMap.container(stage);
61
secondAustraliaMap.draw();
62
63
var title = anychart.standalones.title();
64
title.text("Get and use hover hatch fill");
65
title.container(stage);
66
title.draw();
67
});