问题
I have these two ValueAxes
:
{
...
minimum: 0,
maximum: 100,
strictMinMax: true,
autoGridCount: false,
gridCount: 10
},
{
...
minimum: -15,
maximum: 215,
strictMinMax: true,
autoGridCount: false,
gridCount: 10
}
Now the grid lines of both axes are creating a total mess in the chart and its hard to not get confused while trying to read values. The reason for this is, that AmCharts rounds the labels up or down to ten-steps, not respecting the gridCount
.
I need to know if there's a way to get AmCharts to stop trying to round the labels. I'm totally fine to have numbers like 62
as a label, as long as it reduces the amount of grid lines.
回答1:
My workaround is pretty easy.
I introduced a new option, so that the normal strictMinMax
will still work: strictGridCount
I used the implementation of strictMinMax
and added these lines just a few lines above the place where strictMinMax
is used:
if(_this.strictGridCount) {
if (!isNaN(_this.minimum)) {
_this.min = _this.minimum;
}
if (!isNaN(_this.maximum)) {
_this.max = _this.maximum;
}
_this.step = (_this.max - _this.min) / _this.gridCount;
}
来源:https://stackoverflow.com/questions/32095436/synchronize-valueaxis-grids