2017-06-06 73 views

回答

0

您可以修改labelText屬性自定義標籤。默認情況下,它被設置爲"[[title]]: [[percents]]%",所以將其更改爲"[[percents]]%"將會得到你想要的。

var chart = AmCharts.makeChart("chartdiv", { 
    // ... 
    "labelText": "[[percents]]%", 
    // ... 
}); 

演示下面:

var chart = AmCharts.makeChart("chartdiv", { 
 
    "type": "pie", 
 
    "theme": "light", 
 
    "labelText": "[[percents]]%", 
 
    "dataProvider": [ { 
 
    "country": "Lithuania", 
 
    "litres": 501.9 
 
    }, { 
 
    "country": "Czech Republic", 
 
    "litres": 301.9 
 
    }, { 
 
    "country": "Ireland", 
 
    "litres": 201.1 
 
    }, { 
 
    "country": "Germany", 
 
    "litres": 165.8 
 
    }, { 
 
    "country": "Australia", 
 
    "litres": 139.9 
 
    }, { 
 
    "country": "Austria", 
 
    "litres": 128.3 
 
    }, { 
 
    "country": "UK", 
 
    "litres": 99 
 
    }, { 
 
    "country": "Belgium", 
 
    "litres": 60 
 
    }, { 
 
    "country": "The Netherlands", 
 
    "litres": 50 
 
    } ], 
 
    "valueField": "litres", 
 
    "titleField": "country", 
 
    "balloon":{ 
 
    "fixedPosition":true 
 
    }, 
 
    "export": { 
 
    "enabled": true 
 
    } 
 
});
<script type="text/javascript" src="//www.amcharts.com/lib/3/amcharts.js"></script> 
 
<script type="text/javascript" src="//www.amcharts.com/lib/3/pie.js"></script> 
 
<script type="text/javascript" src="//www.amcharts.com/lib/3/themes/light.js"></script> 
 
<div id="chartdiv" style="width: 100%; height: 400px;"></div>