如何禁用 x 轴 amcharts 的标签

How to disable the labels of x-axis amcharts

我尽量不显示 x 轴的标签,在本例中为: "7.5、8.0、8.5、9.0"等等。

这是我目前尝试过的方法:

<div id="chartdiv"></div>

var chart = AmCharts.makeChart("chartdiv", {
"theme": "light",
"type": "serial",
"dataProvider": [{
    "name": "3s",
    "startTime": 8,
    "endTime": 11,
    "color": "#FF0F00"
}],
"valueAxes": [{
    "axisAlpha": 0,
    "gridAlpha": 0.1
}],
"startDuration": 1,
"graphs": [{
    "balloonText": "<b>[[category]]</b><br>starts at [[startTime]]<br>ends at [[endTime]]",
    "colorField": "color",
    "fillAlphas": 0.8,
    "lineAlpha": 0,
    "openField": "startTime",
    "type": "column",
    "valueField": "endTime"
}],
"rotate": true,
"columnWidth": 1,
"categoryField": "name",  
});

JSFiddle Demo

在你的价值轴上使用labelsEnabled

"valueAxes": [{
    "axisAlpha": 0,
    "gridAlpha": 0.1,
    "labelsEnabled": false
}],

这是updated fiddle

labelsEnabled 也可以用在 categoryAxis 中:

"categoryAxis": {
    "axisColor": "#555555",
    "gridAlpha": 0.1,
    "gridColor": "#FFFFFF",
    "gridCount": 50,        
    "labelsEnabled": false
},

在你的 valueAxis 属性 上使用 integersOnly:

"valueAxes":[{
    "integersOnly": true
}],

现在您的值将显示为 7、8、9...