Amcharts category stickers overlap

I use amCharts version 3 javascript diagrams, and I also tried the latest version.

The problem is this: I have a Chart line with scrollBar, the Axis category of this chart has more than 100 entries, so first the rendering just shows 5-6, and then I zoom in to see more of the Axis category shortcut. So far so good.

But when I zoom in, the labels on categoryAxis overlap, so everything looks confusing actually due to the increase in the number of grids after scaling.

I tried categoryAxis.autoGridCount, but he was out of luck.

Please help in advance.

+3
source share
3 answers

, . , : , parseDate false

categoryAxis.parseDates = false;

categoryAxis.autoGridCount true, gridCount , .

categoryAxis.autoGridCount = true;

categoryAxis.minHorizontalGap = 100;

, - .

:

    //Category Axes
    var categoryAxis = chart2.categoryAxis;
    categoryAxis.gridAlpha = 0;
    categoryAxis.autoGridCount = true;
    categoryAxis.minHorizontalGap = 100;
    categoryAxis.gridPosition = "start";
    categoryAxis.equalSpacing = false;
    categoryAxis.parseDates = false;
    categoryAxis.minPeriod = "DD";
    categoryAxis.startOnAxis = true;
    categoryAxis.axisColor = "#dcdcdc";
    categoryAxis.axisThickness = 1;
    categoryAxis.showLastLabel = true;
+2

, , , , . , !

, , , .

var up = false;

function formatLabel(value, valueString, axis){
    if(up) {
        axis.labelOffset=0;
    }
    else {
        axis.labelOffset=25;
    }
    up=!up;

    return value;
}

https://amcharts.zendesk.com/entries/23473053-Formatting-axis-labels-using-custom-function

, , labelFunction

"categoryAxis": {
    "labelFunction":formatLabel
}
+1

AutoGridCount must be set to true. From your description, I think you have quite a lot of text in your axis labels. I could recommend increasing minHorizontalGap to 100 or so (default 75) for your categoryAxis. If this does not help, I will need to see your chart.

0
source

All Articles