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
var chart = anychart.column();
4
5
// setting title
6
chart.title("X-Axis labels: width is 60px");
7
8
// seting data
9
chart.column([
10
["People's Republic of China", 1336717952],
11
["India", 1189172864],
12
["United States of America", 313232032],
13
["Russian Federation", 138739888],
14
["Japan", 126475664]
15
]);
16
17
// adjusting labels
18
var yTicks = chart.yScale().ticks();
19
yTicks.interval(200000000);
20
var yLabels = chart.yAxis().labels();
21
yLabels.format("${%value}{scale: (1)(1000)(1000)(1000)|(k)(m)(M)(B)}");
22
var xLabels = chart.xAxis().labels();
23
24
// allows to break words at random points
25
xLabels.wordWrap("break-word");
26
27
// breaks in words can be inserted between any characters
28
xLabels.wordBreak("break-all");
29
xLabels.hAlign("center");
30
xLabels.width(60);
31
32
// draw chart
33
chart.container("container");
34
chart.draw();
35
});