xAxis标签未在xrange图表中正确显示

时间:2019-05-10 07:30:13

标签: angular angular2-highcharts

我想在同一行中显示xrange图表的两个xAxis标签(StartLabel和EndLabel)。

 this.statusStackedBarChart = new Chart({
  chart: {
    type: 'xrange',
    events: {
      render: function () {
        let chart = this;
        let leftTextBBox;
        let rightTextBBox;

        if (chart.leftText) {
          chart.leftText.destroy();
        }
        if (chart.rightText) {
          chart.rightText.destroy();
        }

    chart.leftText = chart.renderer.text(
          moment(1525132800000).format('YYYY-MM-DD HH:mm'), // text
          chart.plotLeft, // x position
          chart.plotTop + chart.plotSizeY // y position
        ).add();

        chart.rightText = chart.renderer.text(
          moment(1561939200000).format('YYYY-MM-DD HH:mm'), // text
          chart.plotLeft + chart.plotSizeX, // x position
          chart.plotTop + chart.plotSizeY // y position
        ).add();

        leftTextBBox = chart.leftText.getBBox();
        rightTextBBox = chart.rightText.getBBox();

        chart.leftText.translate(0, leftTextBBox.height);
        chart.rightText.translate(-rightTextBBox.width, rightTextBBox.height);
      },
    }
  },
  title: {
    text: ''
  },

Image正如您在图像中的日期时间所看到的那样,因此日期和时间应显示在同一行

0 个答案:

没有答案
相关问题