|
@@ -39,10 +39,13 @@ export default class PieChart extends AggregationChart { |
|
|
s.sliceStrings = []; |
|
|
s.sliceStrings = []; |
|
|
s.slicesProperties = []; |
|
|
s.slicesProperties = []; |
|
|
let curAngle = 180 - this.config.startAngle; |
|
|
let curAngle = 180 - this.config.startAngle; |
|
|
|
|
|
|
|
|
s.sliceTotals.map((total, i) => { |
|
|
s.sliceTotals.map((total, i) => { |
|
|
const startAngle = curAngle; |
|
|
const startAngle = curAngle; |
|
|
const originDiffAngle = (total / s.grandTotal) * FULL_ANGLE; |
|
|
const originDiffAngle = (total / s.grandTotal) * FULL_ANGLE; |
|
|
|
|
|
let largeArc = 0; |
|
|
|
|
|
if(originDiffAngle > 180){ |
|
|
|
|
|
largeArc = 1; |
|
|
|
|
|
} |
|
|
const diffAngle = clockWise ? -originDiffAngle : originDiffAngle; |
|
|
const diffAngle = clockWise ? -originDiffAngle : originDiffAngle; |
|
|
const endAngle = curAngle = curAngle + diffAngle; |
|
|
const endAngle = curAngle = curAngle + diffAngle; |
|
|
const startPosition = getPositionByAngle(startAngle, radius); |
|
|
const startPosition = getPositionByAngle(startAngle, radius); |
|
@@ -58,8 +61,7 @@ export default class PieChart extends AggregationChart { |
|
|
curStart = startPosition; |
|
|
curStart = startPosition; |
|
|
curEnd = endPosition; |
|
|
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.sliceStrings.push(curPath); |
|
|
s.slicesProperties.push({ |
|
|
s.slicesProperties.push({ |
|
|
startPosition, |
|
|
startPosition, |
|
|