Skip to content

Commit

Permalink
fix(pie): pie chart avoidLabelOverlap hides label. close #13938
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick22nd committed Jan 25, 2021
1 parent 5b4a211 commit ab12807
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/chart/pie/labelLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ import { shiftLayoutOnY } from '../../label/labelLayoutHelper';
const RADIAN = Math.PI / 180;

interface LabelLayout {
label: ZRText,
labelLine: Polyline,
position: PieSeriesOption['label']['position'],
label: ZRText
labelLine: Polyline
position: PieSeriesOption['label']['position']
len: number
len2: number
minTurnAngle: number
maxSurfaceAngle: number
surfaceNormal: Point
linePoints: VectorArray[]
textAlign: HorizontalAlign
labelDistance: number,
labelAlignTo: PieSeriesOption['label']['alignTo'],
edgeDistance: number,
bleedMargin: PieSeriesOption['label']['bleedMargin'],
labelDistance: number
labelAlignTo: PieSeriesOption['label']['alignTo']
edgeDistance: number
bleedMargin: PieSeriesOption['label']['bleedMargin']
rect: BoundingRect
}

Expand Down Expand Up @@ -104,7 +104,7 @@ function adjustSingleSide(
// horizontal r is always same with original r because x is not changed.
const rA = r + item.len;
// Canculate rB based on the topest / bottemest label.
const rB = dx < rA
const rB = Math.abs(dx) < rA
? Math.sqrt(dy * dy / (1 - dx * dx / rA / rA))
: rA;
semi.rB = rB;
Expand Down Expand Up @@ -455,4 +455,4 @@ export default function pieLabelLayout(
}
}
}
}
}

0 comments on commit ab12807

Please sign in to comment.