Skip to content

Commit

Permalink
chore: updated distribution files
Browse files Browse the repository at this point in the history
  • Loading branch information
scmmishra committed May 22, 2019
1 parent ef72925 commit ea309af
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 17 deletions.
20 changes: 12 additions & 8 deletions dist/frappe-charts.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,13 +529,12 @@ function makePath(pathStr, className='', stroke='none', fill='none', strokeWidth
});
}

function makeArcPathStr(startPosition, endPosition, center, radius, clockWise=1){
function makeArcPathStr(startPosition, endPosition, center, radius, clockWise=1, largeArc=0){
let [arcStartX, arcStartY] = [center.x + startPosition.x, center.y + startPosition.y];
let [arcEndX, arcEndY] = [center.x + endPosition.x, center.y + endPosition.y];

return `M${center.x} ${center.y}
L${arcStartX} ${arcStartY}
A ${radius} ${radius} 0 0 ${clockWise ? 1 : 0}
A ${radius} ${radius} 0 ${largeArc} ${clockWise ? 1 : 0}
${arcEndX} ${arcEndY} z`;
}

Expand Down Expand Up @@ -2384,10 +2383,13 @@ class PieChart extends AggregationChart {
s.sliceStrings = [];
s.slicesProperties = [];
let curAngle = 180 - this.config.startAngle;

s.sliceTotals.map((total, i) => {
const startAngle = curAngle;
const originDiffAngle = (total / s.grandTotal) * FULL_ANGLE;
let largeArc = 0;
if(originDiffAngle > 180){
largeArc = 1;
}
const diffAngle = clockWise ? -originDiffAngle : originDiffAngle;
const endAngle = curAngle = curAngle + diffAngle;
const startPosition = getPositionByAngle(startAngle, radius);
Expand All @@ -2403,8 +2405,7 @@ class PieChart extends AggregationChart {
curStart = startPosition;
curEnd = endPosition;
}
const curPath = makeArcPathStr(curStart, curEnd, this.center, this.radius, this.clockWise);

const curPath = makeArcPathStr(curStart, curEnd, this.center, this.radius, clockWise, largeArc);
s.sliceStrings.push(curPath);
s.slicesProperties.push({
startPosition,
Expand Down Expand Up @@ -3727,7 +3728,10 @@ class DonutChart extends AggregationChart {
calc() {
super.calc();
let s = this.state;
this.radius = (this.height > this.width ? this.center.x - (this.strokeWidth / 2) : this.center.y - (this.strokeWidth / 2));
this.radius =
this.height > this.width
? this.center.x - this.strokeWidth / 2
: this.center.y - this.strokeWidth / 2;

const { radius, clockWise } = this;

Expand Down Expand Up @@ -3796,7 +3800,7 @@ class DonutChart extends AggregationChart {
}

calTranslateByAngle(property){
const{radius,hoverRadio} = this;
const{ radius, hoverRadio } = this;
const position = getPositionByAngle(property.startAngle+(property.angle / 2),radius);
return `translate3d(${(position.x) * hoverRadio}px,${(position.y) * hoverRadio}px,0)`;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/frappe-charts.min.cjs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/frappe-charts.min.cjs.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/frappe-charts.min.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/frappe-charts.min.esm.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/frappe-charts.min.iife.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/frappe-charts.min.iife.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/js/frappe-charts.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/assets/js/frappe-charts.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "rollup -c --watch",
"dev": "npm-run-all --parallel watch reload"
"dev": "npm-run-all --parallel watch"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit ea309af

Please sign in to comment.