Skip to content

Commit 39a2de6

Browse files
committed
WIP(chord): init animation
1 parent 01bea53 commit 39a2de6

File tree

3 files changed

+18
-47
lines changed

3 files changed

+18
-47
lines changed

src/chart/chord/ChordEdge.ts

-27
Original file line numberDiff line numberDiff line change
@@ -113,33 +113,6 @@ export class ChordEdge extends graphic.Path<ChordEdgePathProps> {
113113
if (firstCreate) {
114114
el.setShape(shape);
115115
applyEdgeFill(el, edge, nodeData, lineStyle);
116-
117-
if (startAngle != null) {
118-
const x = shape.cx + shape.r * Math.cos(startAngle);
119-
const y = shape.cy + shape.r * Math.sin(startAngle);
120-
el.setShape({
121-
s1: [x, y],
122-
s2: [x, y],
123-
sStartAngle: startAngle,
124-
sEndAngle: startAngle,
125-
t1: [x, y],
126-
t2: [x, y],
127-
tStartAngle: startAngle,
128-
tEndAngle: startAngle
129-
});
130-
graphic.initProps(el, {
131-
shape
132-
}, seriesModel, edgeIdx);
133-
}
134-
else {
135-
el.setShape({
136-
sEndAngle: el.shape.sStartAngle,
137-
tEndAngle: el.shape.tStartAngle
138-
});
139-
graphic.updateProps(el, {
140-
shape
141-
}, seriesModel, edgeIdx);
142-
}
143116
}
144117
else {
145118
saveOldStyle(el);

src/chart/chord/ChordPiece.ts

+5-18
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,11 @@ export default class ChordPiece extends graphic.Sector {
4343

4444
if (firstCreate) {
4545
el.setShape(shape);
46-
47-
if (startAngle != null) {
48-
el.setShape({
49-
startAngle,
50-
endAngle: startAngle
51-
});
52-
graphic.initProps(el, {
53-
shape: {
54-
startAngle: shape.startAngle,
55-
endAngle: shape.endAngle
56-
}
57-
}, seriesModel, idx);
58-
}
59-
else {
60-
graphic.updateProps(el, {
61-
shape: shape
62-
}, seriesModel, idx);
63-
}
46+
}
47+
else {
48+
graphic.updateProps(el, {
49+
shape: shape
50+
}, seriesModel, idx);
6451
}
6552

6653
const sectorShape = extend(

src/chart/chord/ChordView.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ import SeriesData from '../../data/SeriesData';
2626
import ChordSeriesModel from './ChordSeries';
2727
import ChordPiece from './ChordPiece';
2828
import { ChordEdge } from './ChordEdge';
29-
import { normalizeArcAngles } from 'zrender/src/core/PathProxy';
29+
import { parsePercent } from '../../util/number';
3030

31-
const PI2 = Math.PI * 2;
3231
const RADIAN = Math.PI / 180;
3332

3433
class ChordView extends ChartView {
@@ -71,6 +70,18 @@ class ChordView extends ChartView {
7170

7271
.execute();
7372

73+
if (!oldData) {
74+
const center = seriesModel.get('center');
75+
this.group.scaleX = 0.01;
76+
this.group.scaleY = 0.01;
77+
this.group.originX = parsePercent(center[0], api.getWidth());
78+
this.group.originY = parsePercent(center[1], api.getHeight());
79+
graphic.initProps(this.group, {
80+
scaleX: 1,
81+
scaleY: 1
82+
}, seriesModel);
83+
}
84+
7485
this._data = data;
7586

7687
this.renderEdges(seriesModel, startAngle);

0 commit comments

Comments
 (0)