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
$.ajax({
3
type: "GET",
4
url: "https://static.anychart.com/images/docs/seat_map/house.svg",
5
success: function (svgData) {
6
createSeatMap(svgData);
7
}
8
});
9
});
10
11
function createSeatMap(svg){
12
// create a new seat map
13
var chart = anychart.seatMap();
14
// load SVG data
15
chart.geoData(svg);
16
// set the title
17
chart.title("Adjust tooltips");
18
// create new series
19
seatMapSeries = chart.choropleth();
20
// load data
21
seatMapSeries.data([
22
{id: "Hall", value: "720", info: "30\' 0\" x 24\'0\"", sq: "720 sq. ft."},
23
{id: "Room2", value: "165", info: "15\' 0\" x 11\'0\"", sq: "165 sq. ft."},
24
{id: "WC", value: "49", info: "7\' 0\" x 7\'0\"", sq: "49 sq. ft."},
25
{id: "Room1", value: "143", info: "11\' 0\" x 13\'0\"", sq: "143 sq. ft."},
26
{id: "Kitchen", value: "208", info: "13\' 0\" x 16\'0\"", sq: "208 sq. ft."}
27
]);
28
29
// set the filling color
30
seatMapSeries.fill("white");
31
32
// set the tooltips
33
tooltips = seatMapSeries.tooltip();
34
35
// set the tooltips titles and body texts
36
tooltips.titleFormat("{%id}");
37
tooltips.format("{%info}");
38
39
// set the tooltips colors
40
tooltips.background("green 0.8");
41
tooltips.separator("white");
42
43
// load SVG image and don't show elements without values in the data set
44
chart.unboundRegions("hide");
45
46
// set container id for the chart
47
chart.container("container");
48
// initiate chart drawing
49
chart.draw();
50
};