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
// chart type
4
var chart = anychart.area();
5
6
// set data
7
chart.splineArea([
8
{x: "P1", value: 16},
9
{x: "P2", value: 12},
10
{x: "P3", value: 9},
11
{x: "P5", value: 10},
12
{x: "P6", value: 12.5},
13
{x: "P7", value: 14},
14
{x: "P8", value: 17},
15
{x: "P9", value: 18},
16
{x: "P10", value: 15},
17
{x: "P11", value: 11},
18
{x: "P12", value: 8},
19
{x: "P13", value: 5},
20
{x: "P14", value: 6},
21
{x: "P15", value: 11},
22
{x: "P16", value: 13},
23
{x: "P17", value: 18},
24
{x: "P18", value: 21},
25
{x: "P19", value: 25},
26
{x: "P20", value: 28}
27
]);
28
29
// adjust title background fill
30
var title = chart.title();
31
title.text("Gradient Background Fill");
32
title.enabled(true);
33
title.padding(5);
34
var titleBackground = chart.title().background();
35
titleBackground.enabled(true);
36
titleBackground.fill("gold");
37
38
// adjust chart background fill
39
var background = chart.background();
40
background.fill({
41
// set colors position
42
keys: ["#FFF", "#66F", "#FFF"],
43
// set angle of colors drawing
44
angle: -130
45
});
46
47
// draw
48
chart.container("container");
49
chart.draw();
50
});