Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
CBlogx opened this issue Apr 25, 2023 · 0 comments
Open

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

CBlogx opened this issue Apr 25, 2023 · 0 comments

Comments

@CBlogx
Copy link

CBlogx commented Apr 25, 2023

// 报错内容
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))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant