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
// configure json data
4
var json = {
5
// configure the chart
6
"chart": {
7
// set the column chart type
8
"type": "column",
9
// set the chart height
10
"height": "50%",
11
"width": "50%",
12
// set the chart data
13
"series": [{
14
"data": [
15
{x: "Q1", value: 8},
16
{x: "Q2", value: 12},
17
{x: "Q3", value: 18},
18
{x: "Q4", value: 11}
19
],
20
}],
21
// set the chart container
22
"container": "container"
23
}
24
};
25
26
// get the json data
27
var chart = anychart.fromJson(json);
28
29
// set the chart title
30
chart.title("Width and Height — JSON");
31
32
// draw the chart
33
chart.draw();
34
35
});