如何在 AmChart 的 y 轴上将最大值设置为 1,将最小值设置为 0?

How can i set max value to 1 and min value to 0 on y-axis for an AmChart?

    var chart = AmCharts.makeChart("chartdiv", {
      "type": "serial",
      "dataProvider": chartData,
      "categoryField": "date",
      "categoryAxis": {
        "parseDates": false,
        "gridAlpha": 0.15,
        "minorGridEnabled": true,
        "axisColor": "#DADADA",
        "title": 'Timp'
      },
      "valueAxes": [{
        "axisAlpha": 0.2,
        "id": "v1",

      }],
      "graphs": [{
        "title": "Starea echipamentului",
        "id": "g1",
        "valueAxis": "v1",
        "valueField": "starea",
        "autoGridCount": true,
        "bullet": "round",
        "bulletBorderColor": "#FFFFFF",
        "bulletBorderAlpha": 1,
        "lineThickness": 2,
        "lineColor": "#b5030d",
        "negativeLineColor": "#0352b5",
        "balloonText": "[[category]]<br><b><span style='font-size:14px;'>value: [[value]]</span></b>",

      }],
       "titles": [
    {
      "size": 15,
      "text": window.location.href.split('?')[1].split('=')[1].replace('%20',' ')
    }
  ],

        "legend": {
    "useGraphSettings": true
  },

      "chartCursor": {
        "fullWidth": true,
        "cursorAlpha": 0.1
      },
      "chartScrollbar": {
        "scrollbarHeight": 40,
        "color": "#FFFFFF",
        "autoGridCount": true,
        "graph": "g1"
      },
      "mouseWheelZoomEnabled": true,
      "responsive": {
        "enabled": true
      },
      "export": {
          "enabled": true,
          "libs": {
            "path": "http://amcharts.com/lib/3/plugins/export/libs/"
          }
        }
    });

所以我在 y 轴上的图表只有 0、0.5 和 1 值。如果我有图表的一部分,其中我在 y 轴上有 0.5,它的 apeears 值在 0.5(0.4 最小值和 0.6 最大值)之间。我怎么希望我的图表在 y 轴上显示 0 和 1,而不是 1.2。有什么想法吗?

对值轴使用 minimum and maximum 属性:

 "valueAxes": [{
    "axisAlpha": 0.2,
    "id": "v1",
    "minimum": 0,
    "maximum": 1
 }],

这应该可以解决问题。

在极少数情况下,您可能还想设置 strictMinMax。但是对于这种特殊情况,您可能不需要它。