echarts [Bug] appendData 方法不好使,网格类型的热力图,使用appendData后,数据没有更新,界面没有现在新增

nbnkbykc  于 4个月前  发布在  Echarts
关注(0)|答案(3)|浏览(101)

Version

5.5

Steps to Reproduce

initChart() {
  let that = this;
  //初始化X坐标轴
  // let xValue = [];
  // for (let i = 100; i < 900; i++) {
  //   xValue.push(i);
  // }
  const xValue = ['6', '6.5', '7', '7.5', '8', '8.5', '9', '9.5', '10'];
  const yValue = ['6', '6.5', '7', '7.5', '8', '8.5', '9', '9.5', '10'];
  //初始化Y坐标轴
  // let yValue = [];
  // for (let i = -26; i < 27; i++) {
  //   yValue.push(i);
  // }

  let option = {
    xAxis: {
      type: 'category',
      data: xValue,
      splitArea: {
        show: true //斑马纹展示
      }
    },
    yAxis: {
      type: 'category',
      data: yValue,
      splitArea: {
        show: true //斑马纹展示
      }
    },
    title: {
      top: 30,
      left: 'center',
      text: 'Daily Step Count'
    },
    tooltip: {},
    visualMap: {
      min: 0,
      max: 10000,
      type: 'piecewise',
      orient: 'horizontal',
      left: 'center',
      top: 65
    },

    series: {
      type: 'heatmap',
      name: 'Znys Map',
      data: that.seriesData,
    }
  };

  option && that.myChart.setOption(option);
},

Current Behavior

this.myChart = echarts.init(chartDom);
this.initChart();
let i = 1, j = 0
let data=[];
// this.timer = setInterval(function () {
for (let j = 0; j < 10; j++) {
  let dataItem = [];
  dataItem.push(j);
  dataItem.push(i);
  dataItem.push(8);
  dataItem.push(i * 2);
  // that.seriesData.push(dataItem);
  data.push(dataItem);
  // this.myChart.setOption({
  //       series: [{
  //         // 假设是某个系列
  //         data: data // 这里替换为你要添加的数据
  //       }]
  //     });
  this.myChart.appendData({
    seriesIndex: 0,
    data: data
  });
  console.log('size is:'+this.seriesData.length)
}

Expected Behavior

appendData有效

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

pkwftd7m

pkwftd7m1#

@yu0784 It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
TRANSLATED

TITLE

[Bug] The appendData method does not work well. For grid-type heat maps, after using appendData, the data is not updated and the interface is not newly added.

ha5z0ras

ha5z0ras2#

coordinateSystem: 'cartesian2d' 类型

dgtucam1

dgtucam13#

cannot replicate, heatmap appendData works fine - Demo .
📌 please close issue if problem solved.

相关问题