简体   繁体   中英

How to disable the labels of x-axis amcharts

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.

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",  
});

JSFiddle Demo

Use labelsEnabled on your value axis:

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

Here's the updated fiddle .

labelsEnabled can be used in categoryAxis as well:

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

Use integersOnly on your valueAxis property:

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

Now your value will be displayed like 7, 8, 9...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM