首页 > 其他 > 详细

Cannot read property 'scales' of undefined

时间:2020-02-01 21:45:39      阅读:803      评论:0      收藏:0      [点我收藏+]

该报错在 antv f2 绘制柱状图文本是产生
原因: 在图表渲染之前绘制
解决:在 chart.render(); 之后绘制

// ....

   chart.render();

      // 绘制柱状图文本
      const offset = -5;
      const canvas = chart.get("canvas");
      const group = canvas.addGroup();
      const shapes = {};
      data.forEach(function(obj) {
        const point = chart.getPosition(obj);
        const text = group.addShape("text", {
          attrs: {
            x: point.x,
            y: point.y + offset,
            text: obj.confirmedCount,
            textAlign: "center",
            textBaseline: "bottom",
            fill: "#808080"
          }
        });
        shapes[obj.year] = text; // 缓存该 shape, 便于后续查找
      });

Cannot read property 'scales' of undefined

原文:https://www.cnblogs.com/guangzan/p/12247371.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!