HTMLcopy
1
<div id="mekko-container"></div>
CSScopy
8
1
html,
2
body,
3
#mekko-container {
4
width: 100%;
5
height: 100%;
6
margin: 0;
7
padding: 0;
8
}
JavaScriptcopy
31
1
anychart.onDocumentReady(function () {
2
3
// create a dataset
4
var data = {
5
title: "2022 U.S. Quarterly Auto Sales by Top 8 Brands",
6
header: ["Name", "Q1", "Q2", "Q3", "Q4"],
7
rows: [
8
["Ford", 410.0, 453.5, 441.4, 459.1],
9
["Toyota", 433.4, 416.8, 411.9, 456.5],
10
["Chevrolet", 342.6, 383.8, 371.4, 415.0],
11
["Honda", 238.1, 215.1, 200.2, 227.5],
12
["Hyundai", 152.3, 184.1, 184.4, 195.9],
13
["Jeep", 193.2, 186.6, 161.3, 143.3],
14
["Nissan", 189.8, 172.6, 142.8, 177.4],
15
["Kia", 149.0, 172.8, 181.1, 175.4]
16
]
17
};
18
19
// create a mekko (marimekko) chart
20
var chart = anychart.mekko();
21
22
// add the data to the chart
23
chart.data(data);
24
25
// set a container
26
chart.container("mekko-container");
27
28
// draw the chart
29
chart.draw();
30
31
});