amCharts valueAxis最大值不起作用 [英] amCharts valueAxis maximum not working

查看:221
本文介绍了amCharts valueAxis最大值不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个显示百分比的图表,所以我不想在valueAxis上超过100.由于某些原因,valueAxis.maximum对我不起作用.这是我的图表函数的副本.该图表最终在valueAxis中显示最大110.我在某处缺少物业吗?

I have a chart that shows percentages, so I don't want to go past 100 on the valueAxis. For some reason, valueAxis.maximum isn't working for me. Here's a copy of my chart function. The chart ends up showing with 110 maximum in the valueAxis. Am I missing a property somewhere?

这是 jsFiddle 的链接.感谢您的帮助.

Here's a link to a jsFiddle. Any help is appreciated.

var chart = AmCharts.makeChart(chartDiv, {
    "theme": "light",
    "type": "serial",
    "dataProvider": nflDailyData,
    "graphs": [{
        "balloonText": "[[value]]% for [[category]]",
        "fillAlphas": 0.5,
        "lineAlpha": 0.2,
        "title": "Percent Accuracy",
        "type": "column",
        "valueField": "value",
        "legendValueText": "",
        "fillColorsField": "color"
    }],
    "titles": [ 
        {
            "text": "NFL Daily Past 7-Day Evaluation",
            "size": 26,
            "color": "#3333cc"
        }
    ],
    "startDuration": 1,
    "depth3D": 20,
    "angle": 30,
    "rotate": false,
    "categoryField": "category",
    "valueAxis": {
        "minimum": 0,
        "maximum": 100,
        "unit": "%",
        "unitPosition": "right"
    },
    "categoryAxis": {
        "gridPosition": "start",
        "fillAlpha": 0.05,
        "position": "left",
        "labelRotation": 45
    },
    "export": {
        "enabled": true
     }
});

推荐答案

由于图表支持多个值轴,因此没有单个"valueAxis"参数.它是一个对象数组,并且是复数形式: valueAxes .因此,在图表配置中,如果只有一个值轴,则需要这样指定事件:

Since the chart supports multiple value axes, there's no single "valueAxis" parameter. It's an array of objects, and it's in plural: valueAxes. So in your chart configuration, you need to specify it as such, event if you have just one value axis:

"valueAxes": [{
  "minimum": 0,
  "maximum": 100,
  "unit": "%",
  "unitPosition": "right"
}]

您现在拥有它的方式会被图表忽略,因此不会考虑maximum.

The way you have it now is simply ignored by the chart, hence maximum not being taken into account.

这篇关于amCharts valueAxis最大值不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆