amCharts valueAxis maximum not working

流过昼夜 提交于 2019-12-11 13:09:13

问题


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?

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

回答1:


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"
}]

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



来源:https://stackoverflow.com/questions/35075659/amcharts-valueaxis-maximum-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!