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 stage
4
var stage = anychart.graphics.create("container");
5
6
// create data
7
var data = [
8
{x: "Start", value: 23},
9
{x: "Jan", value: 22},
10
{x: "Feb", value: -46},
11
{x: "Mar", value: -91},
12
{x: "Apr", value: 37},
13
{x: "May", value: -21},
14
{x: "Jun", value: undefined},
15
{x: "Jul", value: 31},
16
{x: "Aug", value: -15},
17
{x: "Sep", value: 42},
18
{x: "Oct", value: 53},
19
{x: "Nov", value: -15},
20
{x: "Dec", value: 51},
21
{x: "End"}
22
];
23
24
// create and configure the first waterfall chart
25
var chart1 = anychart.waterfall(data);
26
chart1.getSeriesAt(0).connectMissingPoints(false);
27
chart1.title("Data Mode: Difference");
28
chart1.bounds(0, 0, "100%", "50%");
29
chart1.legend(false);
30
// set the data mode
31
chart1.dataMode("diff");
32
// set the chart container
33
chart1.container(stage);
34
// initiate drawing the chart
35
chart1.draw();
36
37
// create and configure the second waterfall chart
38
var chart2 = anychart.waterfall(data);
39
chart2.title("Data Mode: Absolute");
40
chart2.bounds(0, "50%", "100%", "50%");
41
chart2.legend(false);
42
// set the data mode
43
chart2.dataMode("absolute");
44
// set the chart container
45
chart2.container(stage);
46
// initiate drawing the chart
47
chart2.draw();
48
});