javascript 如何更改 AmCharts 的图例 labelText?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28307058/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 08:45:06  来源:igfitidea点击:

How to alter legend labelText for AmCharts?

javascriptamcharts

提问by juliet

I am creating a pie chart using AmCharts. I am trying to alter the legend lablelText to show the title, percent and value. I have tried the following which is not working: (This is being passed to the AmCharts.makeChart() method

我正在使用 AmCharts 创建饼图。我正在尝试更改图例 labellText 以显示标题、百分比和值。我尝试了以下不起作用的方法:(这被传递给 AmCharts.makeChart() 方法

            "legend": {
                "align": "center",
                "position": "right",
                "marginRight": 21,
                "markerType": "circle",
                "right": -4,
                "labelText": "[[title]]: [[percents]]% $[[value]]",
            },

回答by juliet

In the end I discovered I should be using valueText not labelText and so was able to change to this:

最后我发现我应该使用 valueText 而不是 labelText ,因此能够更改为:

           "legend": {
                "align": "center",
                "position": "bottom",
                "marginRight": 21,
                "markerType": "circle",
                "right": -4,
                "labelText": "[[title]]",
                "valueText": " $[[value]] [[percents]]%",
                "valueWidth": 80,
                "textClickEnabled": true
            },