amCharts valueAxis最大值不起作用

时间:2016-01-29 02:04:08

标签: javascript amcharts

我有一个显示百分比的图表,因此我不想在valueAxis上超过100。出于某种原因,valueAxis.maximum对我不起作用。这是我的图表功能的副本。该图表最终在valueAxis中显示最大值110。我在某个地方错过了一处房产吗?

这是指向jsFiddle的链接。任何帮助表示赞赏。

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

1 个答案:

答案 0 :(得分:3)

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

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

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