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
var stage = anychart.graphics.create("container");
3
// create charts
4
chart1 = anychart.sparkline();
5
chart2 = anychart.sparkline();
6
7
chart1.seriesType("column");
8
chart2.seriesType("column");
9
10
chart1.title("Column 1");
11
chart2.title("Column 2");
12
13
// create data for both charts
14
chart1.data([-20, 30, 50, -10, 25, -50, 70, 10]);
15
chart2.data([20, 30, -10, 20, -35, -15, -40, 50]);
16
17
// set charts dimensions and position
18
chart1.bounds(0, 0, 300, 120);
19
chart2.bounds(0, 120, 300, 120);
20
21
// colorize our charts
22
chart1.maxLabels().enabled(true);
23
chart2.maxLabels().enabled(true);
24
chart1.minLabels().enabled(true);
25
chart2.minLabels().enabled(true);
26
27
// set container id for the charts
28
chart1.container(stage);
29
chart2.container(stage);
30
31
// initiate chart drawing
32
chart1.draw();
33
chart2.draw();
34
35
});