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 data
4
var data = [
5
{x: "Start", value: 23},
6
{x: "Jan", value: 22},
7
{x: "Feb", value: -46},
8
{x: "Mar", value: -91},
9
{x: "Apr", value: 37},
10
{x: "May", value: -21},
11
{x: "Jun", value: 53},
12
{x: "Jul", value: 31},
13
{x: "Aug", value: -15},
14
{x: "Sep", value: 42},
15
{x: "Oct", value: 53},
16
{x: "Nov", value: -15},
17
{x: "Dec", value: 51},
18
{x: "End", isTotal: true}
19
];
20
21
// create a waterfall chart
22
var chart = anychart.waterfall();
23
24
// create a series and set the data
25
var series = chart.waterfall(data);
26
27
// configure the visual settings of the series
28
series.normal().fill("#ff6666", 0.3);
29
series.normal().hatchFill("forward-diagonal", "#ff6666", 0.5, 10);
30
series.normal().stroke("#ff6666");
31
series.hovered().fill("#ff6666", 0.1);
32
series.hovered().hatchFill("forward-diagonal", "#ff6666", 0.5, 10);
33
series.hovered().stroke("#ff6666", 2);
34
series.selected().fill("#ff6666", 0.5);
35
series.selected().hatchFill("forward-diagonal", "#ff6666", 0.5, 10);
36
series.selected().stroke("#ff6666", 4);
37
38
series.normal().fallingFill("#00cc99", 0.3);
39
series.normal().fallingStroke("#00cc99", 1, "10 5", "round");
40
series.hovered().fallingFill("#00cc99", 0.1);
41
series.hovered().fallingStroke("#00cc99", 2, "10 5", "round");
42
series.selected().fallingFill("#00cc99", 0.5);
43
series.selected().fallingStroke("#00cc99", 4, "10 5", "round");
44
45
series.normal().risingFill("#0066cc", 0.3);
46
series.normal().risingStroke("#0066cc");
47
series.hovered().risingFill("#0066cc", 0.1);
48
series.hovered().risingStroke("#0066cc", 2);
49
series.selected().risingFill("#0066cc", 0.5);
50
series.selected().risingStroke("#0066cc", 4);
51
52
// set the chart title
53
chart.title("Waterfall Chart: Appearance");
54
55
// set the container id
56
chart.container("container");
57
58
// initiate drawing the chart
59
chart.draw();
60
});