如何禁用x轴amcharts的标签

时间:2015-06-09 14:17:44

标签: javascript amcharts

我试图不显示x轴的标签,在这种情况下是: " 7.5,8.0,8.5,9.0和#34;等等。

这是我到目前为止所尝试的:

<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

3 个答案:

答案 0 :(得分:14)

在价值轴上使用labelsEnabled

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

这里是updated fiddle

答案 1 :(得分:1)

labelsEnabled也可以在categoryAxis中使用:

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

答案 2 :(得分:1)

在您的integersOnly属性上使用valueAxis

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

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