Метка xAxis не отображается должным образом в диаграммах xrange - PullRequest
0 голосов
/ 10 мая 2019

Я хочу отобразить две метки xAxis для диаграммы xrange (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: ''
  },

Изображение Как вы можете видеть на изображении дата / время в разделенном виде, поэтому дата ивремя должно отображаться в одной строке

...