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: "1995", value: 0.10},
6
{x: "1996", value: 0.10},
7
{x: "1997", value: 0.12},
8
{x: "1998", value: 0.13},
9
{x: "1999", value: 0.15},
10
{x: "2000", value: 0.15},
11
{x: "2001", value: 0.15},
12
{x: "2002", value: 0.19},
13
{x: "2003", value: 0.20}
14
];
15
16
// create a chart
17
var chart = anychart.stepLine();
18
19
// create a step line series and set the data
20
var series = chart.stepLine(data);
21
22
// set step direction to the forward mode
23
series.stepDirection("forward");
24
25
// set the chart title
26
chart.title("Step Line Chart");
27
28
// set the titles of the axes
29
var xAxis = chart.xAxis();
30
xAxis.title("Year");
31
var yAxis = chart.yAxis();
32
yAxis.title("Rate");
33
34
// set the container id
35
chart.container("container");
36
37
// initiate drawing the chart
38
chart.draw();
39
});