Skip to content

Commit

Permalink
Apply fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreimejov committed May 14, 2020
1 parent 6eb4808 commit 087dd3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kotify/frappe-charts",
"version": "1.4.1k5",
"version": "1.4.1k6",
"description": "https://github.com/kotify/charts",
"main": "dist/kotify-charts.min.cjs.js",
"module": "dist/kotify-charts.min.esm.js",
Expand Down
7 changes: 5 additions & 2 deletions src/js/utils/draw-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,15 @@ export function getSplineCurvePointsStr(xList, yList) {

let bezierCommand = (point, i, a) => {
let cps = controlPoint(a[i - 1], a[i - 2], point);
let cpe = controlPoint(point, a[i - 1], a[i + 1], true);
let cpe = controlPoint(point, a[i], a[i + 1], true);
if (isNaN(cpe[0]) || isNaN(cpe[1])) {
cpe = point;
}
return `C ${cps[0]},${cps[1]} ${cpe[0]},${cpe[1]} ${point[0]},${point[1]}`;
};

let pointStr = (points, command) => {
return points.reduce((acc, point, i, a) => i === 0
return points.filter(point => point[1] !== undefined).reduce((acc, point, i, a) => i === 0
? `${point[0]},${point[1]}`
: `${acc} ${command(point, i, a)}`, '');
};
Expand Down

0 comments on commit 087dd3b

Please sign in to comment.