1
votes

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

1 Answers

3
votes

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.