首页 > 解决方案 > 为什么 xAxis.min 不起作用,但 xAxis.max 是?

问题描述

我正在使用像这个演示这样的 Highstock 图表:https ://www.highcharts.com/demo/stock/responsive

当我设置 xAxis.max 时它可以工作,但是添加 xAxis.min 它会发送正确的时间间隔(1 年)但在错误的日期,在图表的末尾(2021 年 7 月)。

我真的不明白这是怎么回事...

非常感谢

 Highcharts.stockChart('container', {

    data: {
      googleSpreadsheetKey: 'XXX'
    },

    chart: {
      styledMode: true,
    },

    xAxis: {
        min: Date.UTC(2020, 2, 1),
        max: Date.UTC(2021, 2, 1)
    },
    rangeSelector: {
      allButtonsEnabled: true,
      buttonSpacing: 10,
      buttons: [{
        type: 'week',
        count: 1,
        text: '1 Week'
      }, {
        type: 'month',
        count: 1,
        text: '1 Month'
      }, {
        type: 'month',
        count: 3,
        text: '3 Months'
      }, {
        type: 'year',
        count: 1,
        text: '1 Year'
      }, {
        type: 'ytd',
        text: 'YtD'
      }, {
        type: 'all',
        text: 'Max'
      }],
      buttonTheme: {
        width: 75,
      }
    },

    series: [{
      color: '#005d98',
      name: 'USD',
      type: 'area',
      gapSize: 5,
      tooltip: {
        valueDecimals: 2
      },
      fillColor: {
        linearGradient: {
          x1: 0,
          y1: 0,
          x2: 0,
          y2: 2
        },
      },
      threshold: null
    }]
  });```


标签: highcharts

解决方案


推荐阅读