简体   繁体   English

AmCharts Value轴不从零开始

[英]AmCharts Value axis not starting at Zero

I have a AmCharts serial chart with some columns representing numeric values. 我有一个AmCharts序列图,其中一些列表示数值。 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. 我没有成功尝试将属性valueAxis.minimum设置为零。

Is there a way to force a valueAxis to start from zero? 有没有办法强制valueAxis从零开始?

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

Sometimes AmCharts doesn't respect the minimum you set, depending on your data and other factors. 有时AmCharts不尊重您设置的minimum ,具体取决于您的数据和其他因素。 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). 您可以尝试通过设置,迫使它strictMinMax为true,每个valueAxis您希望您的minimum执行(当然,你必须确保你设置minimum中的每个值轴)。

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. 请注意,如果您使用的是此示例底部提到的synchronizeGrid功能,则必须禁用它,否则根本不会考虑您的最小/最大值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM