zelda.j zelda.j - 1 month ago 9
Javascript Question

valueAxes "gridCount" in amchart not working

amchart valueAxes "gridCount" is not working.
I set valueAxes like below.

"valueAxes": [{
"stackType": "regular",
"gridAlpha": 0.07,
"title": "Sessions",
"autoGridCount": false,
"minimum": 0,
"maximum": max,
"gridCount": 4
}]


At the graph, the maximum value appears 6000, so I assumed that sessions grids are 1500, 3000, 4500, 6000 (because 6000 / 4 = 1500) but the graph has only three grids! I don't know why this is so.
You can see the graph and the full code here.
https://jsfiddle.net/dajeongda/L609873w/

Many thanks in advance!

Answer

Looking at the docs (https://docs.amcharts.com/3/javascriptcharts/AxisBase#gridCount) it seems that the gridCount property is used as an approximate. The chart may still adjust it so that it displays grid lines at "pretty" increments.

To draw your own grid lines, you could use their Guides option: http://docs.amcharts.com/3/javascriptstockchart/Guide.