Oignon_Rouge
Oignon_Rouge

Reputation: 305

AmCharts Value axis not starting at Zero

I have a AmCharts serial chart with some columns representing numeric values. Depending on those values, sometimes one of the axes "unsticks" from the ground, making a weird effect. I have unsuccessfully tried to set the property valueAxis.minimum to zero.

Is there a way to force a valueAxis to start from zero?

    AmCharts.makeChart("chartdiv", {
        "type": "serial",
        "synchronizeGrid": true,
        "valueAxes": 
            [{
                "minimum": 0,
                // ...
            }]
        // ...
    });

Upvotes: 1

Views: 4375

Answers (1)

xorspark
xorspark

Reputation: 16012

Sometimes AmCharts doesn't respect the minimum you set, depending on your data and other factors. You can try to force it by setting strictMinMax to true for each valueAxis where you want your minimum enforced (of course, you have to make sure you're setting minimum in each value axis).

AmCharts.makeChart("chartdiv", {
    "type": "serial",
    //"synchronizeGrid": true,
    "valueAxes": 
        [{
            "minimum": 0,
            "strictMinMax": true,
            // ...
        },
         //repeat if you have multiple value axes that need to start from 0
        ]
    // ...
});

Note that if you're using the synchronizeGrid feature mentioned at the bottom of this example, then you have to disable it or else it won't respect your min/max values at all.

Upvotes: 4

Related Questions