两个x轴之间的hightchart tickinterval

时间:2017-01-16 04:03:47

标签: javascript highcharts

我有代码在折线图上显示两个数据:

    $(function () {
  Highcharts.chart('container', {
      chart: {
          type: 'spline'
      },
      title: {
          text: 'Snow depth atasfsa Vikjafjellet, Norway'
      },
      subtitle: {
          text: 'Irregular time data in Highcharts JS'
      },
      xAxis: {
          type: 'datetime',
            dateTimeLabelFormats: { // don't display the dummy year
                  tickInterval: 24 * 3600 * 1000,

              day: '%a'
          },
          title: {
              text: 'Date'
          }
      },
      yAxis: {
          title: {
              text: 'Snow depth (m)'
          },
          min: 0
      },
      tooltip: {
          headerFormat: '<b>{series.name}</b><br>',
          pointFormat: '{point.x:%e. %b}: {point.y:.2f} m'
      },

      plotOptions: {
          pointInterval: 10,
          spline: {
              marker: {
                  enabled: true
              }
          }
      },

      series: [{
          name: 'A',
          // Define the data points. All series have a dummy year
          // of 2016/71 in order to be compared on the same x axis. Note
          // that in JavaScript, months start at 0 for January, 1 for February etc.
          data: [
              [Date.UTC(2016, 11, 1), 0],
              [Date.UTC(2016, 11, 2), 0.28],
              [Date.UTC(2016, 11, 3), 0.25],
              [Date.UTC(2016, 11, 4), 0.2],
              [Date.UTC(2016, 11, 5), 0.28],
              [Date.UTC(2016, 11, 6), 0.28],
              [Date.UTC(2016, 11, 7), 0.47],
              [Date.UTC(2016, 11, 8), 0.47],
              [Date.UTC(2016, 11, 9), 0.47],
              [Date.UTC(2016, 11, 10), 0.47],
              [Date.UTC(2016, 11, 11), 0.47],
              [Date.UTC(2016, 11, 12), 0.47]
          ]
      }, {
          name: 'B',
                    data: [
          [Date.UTC(2017, 0, 1), 0],
          [Date.UTC(2017, 0, 2), 0.4],
          [Date.UTC(2017, 0, 3), 0.25],
          [Date.UTC(2017, 0, 4), 1.66],
          [Date.UTC(2017, 0, 5), 1.8],
          [Date.UTC(2017, 0, 6), 1.76],
          [Date.UTC(2017, 0, 7), 2.62],
          [Date.UTC(2017, 0, 8), 2.41],
          [Date.UTC(2017, 0, 9), 2.05],
          [Date.UTC(2017, 0, 10), 1.7],
          [Date.UTC(2017, 0, 11), 1.1],
          [Date.UTC(2017, 0, 12), 0]
      ]
      }]
  });
});

输出:enter image description here

我想知道如何让B xAxis从太阳&#39;太阳开始。在A xAxis? 我一直在谷歌搜索,但无法找到任何东西,我不知道该找什么....

0 个答案:

没有答案