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: "January", value: 10000},
6
{x: "February", value: 12000},
7
{x: "March", value: 18000,
8
normal: {stroke: "3 #5cd65c"},
9
hovered: {stroke: "4 #5cd65c"},
10
selected: {stroke: "4 #5cd65c"}
11
},
12
{x: "April", value: 11000},
13
{x: "May", value: 9000}
14
];
15
16
// create a chart
17
var chart = anychart.stick();
18
19
// set the interactivity mode
20
chart.interactivity("by-x");
21
22
// create a stick series and set the data
23
var series = chart.stick(data);
24
25
// set the chart title
26
chart.title("Stick Chart: Basic Sample");
27
28
// set the titles of the axes
29
var xAxis = chart.xAxis();
30
xAxis.title("Month");
31
var yAxis = chart.yAxis();
32
yAxis.title("Sales, $");
33
34
// set the container id
35
chart.container("container");
36
37
// initiate drawing the chart
38
chart.draw();
39
});