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
3
// create a data set
4
var data = anychart.data.set([
5
["QTR1", 10000, 12500],
6
["QTR2", 12000, 15000],
7
["QTR3", 13000, 16500],
8
["QTR4", 10000, 13000],
9
]);
10
11
// map the data
12
var seriesData_1 = data.mapAs({x: 0, value: 1});
13
var seriesData_2 = data.mapAs({x: 0, value: 2});
14
15
// create a chart
16
var chart = anychart.mekko();
17
18
// create the first series and set the data
19
var series1 = chart.mekko(seriesData_1);
20
21
// configure the visual settings of the first series
22
series1.normal().fill("#99004d", 0.5);
23
series1.hovered().fill("#99004d", 0.3);
24
series1.selected().fill("#99004d", 0.7);
25
series1.normal().stroke("#99004d", 1);
26
series1.hovered().stroke("#99004d", 2);
27
series1.selected().stroke("#99004d", 4);
28
29
// create the second series and set the data
30
var series2 = chart.mekko(seriesData_2);
31
32
// configure the visual settings of the second series
33
series2.normal().fill("#004d99", 0.5);
34
series2.hovered().fill("#004d99", 0.3);
35
series2.selected().fill("#004d99", 0.7);
36
series2.normal().hatchFill("forward-diagonal", "#004d99", 1, 15);
37
series2.hovered().hatchFill("forward-diagonal", "#004d99", 1, 15);
38
series2.selected().hatchFill("forward-diagonal", "#004d99", 1, 15);
39
series2.normal().stroke("#004d99");
40
series2.hovered().stroke("#004d99", 2);
41
series2.selected().stroke("#004d99", 4);
42
43
// set the chart title
44
chart.title("Mekko Chart: Appearance");
45
46
// set the container id
47
chart.container("container");
48
49
// initiate drawing the chart
50
chart.draw();
51
});