javascript 如何禁用 x 轴 amcharts 的标签
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30734717/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to disable the labels of x-axis amcharts
提问by Umesh
I am trying not to show the labels of x-axis, which in this case are: "7.5, 8.0, 8.5, 9.0" and so on.
我试图不显示 x 轴的标签,在这种情况下是:“7.5、8.0、8.5、9.0”等等。
This is what I have tried so far:
这是我迄今为止尝试过的:
<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",
});
回答by martynasma
Use labelsEnabled
on your value axis:
使用labelsEnabled
您的值轴:
"valueAxes": [{
"axisAlpha": 0,
"gridAlpha": 0.1,
"labelsEnabled": false
}],
Here's the updated fiddle.
这是更新的 fiddle。
回答by Oleg Neumyvakin
labelsEnabled
can be used in categoryAxis
as well:
labelsEnabled
也可以用于categoryAxis
:
"categoryAxis": {
"axisColor": "#555555",
"gridAlpha": 0.1,
"gridColor": "#FFFFFF",
"gridCount": 50,
"labelsEnabled": false
},
回答by user2992355
Use integersOnly
on your valueAxis
property:
integersOnly
在您的valueAxis
财产上使用:
"valueAxes":[{
"integersOnly": true
}],
Now your value will be displayed like 7, 8, 9...
现在您的值将显示为 7, 8, 9 ...