HTMLcopy
1
<button onclick="ticks.allowFractional(true)">Fractional</button>
2
<button onclick="ticks.allowFractional(false)">Integer</button>
3
<div id="container"></div>
CSScopy
15
1
html, body {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
7
button {
8
margin: 10px 0 0 10px;
9
}
10
#container {
11
position: absolute;
12
width: 100%;
13
top: 35px;
14
bottom: 0;
15
}
JavaScriptcopy
x
1
var ticks;
2
anychart.onDocumentReady(function () {
3
var chart = anychart.column([
4
{x: "Soprano", value: 1.1},
5
{x: "Alto", value: 0.1},
6
{x: "Tenor", value: 2.5},
7
{x: "Bass", value: 1.8}
8
]);
9
10
// force ticks to stick to integer values
11
ticks = chart.yScale().ticks();
12
ticks.allowFractional(false);
13
14
// set the chart title
15
chart.title("Ticks Fractional Values: Disable and Enable");
16
17
// set the container id
18
chart.container("container");
19
20
// initiate drawing the chart
21
chart.draw();
22
});