DataV-Team / DataV

Vue数据可视化组件库(类似阿里DataV,大屏数据展示),提供SVG的边框及装饰、图表、水位图、飞线图等组件,简单易用,长期更新(React版已发布)
http://datav.jiaminghi.com
MIT License
8.98k stars 1.77k forks source link

柱线图数据更新时报错 Invalid array length (chorme) #296

Open CBlogx opened 1 year ago

CBlogx commented 1 year ago

// 报错内容 RangeError: Invalid array length at eval (bezierCurveToPolyline.js?2db9:123) at Array.map () at getSegmentPointsDistance (bezierCurveToPolyline.js?2db9:122) at eval (bezierCurveToPolyline.js?2db9:233) at Array.forEach () at _loop (bezierCurveToPolyline.js?2db9:226) at calcUniformPointsByIteration (bezierCurveToPolyline.js?2db9:254) at abstractBezierCurveToPolyline (bezierCurveToPolyline.js?2db9:59) at bezierCurveToPolyline (bezierCurveToPolyline.js?2db9:294) at Graph.draw (graphs.js?b06d:591)

// 解决办法 // 定位到node_modules/@jiaminghi/bezier-curve/src/core/bezierCurveToPolyline.js

function getSegmentPointsDistance(segmentPoints) {
  return segmentPoints.map(function (points, i) {
    return new Array(points.length - 1).fill(0).map(function (temp, j) {
      return getTwoPointDistance(points[j], points[j + 1]);
    });
  });
}

// 将 return new Array(points.length - 1) 更改为 return new Array(Math.max(0, points.length - 1))