Skip to content

Commit d6438e8

Browse files
authored
feat(ring-progress): 将环形进度条的z-index进行调整,默认置顶 shape0 (#2344)
1 parent 674d51f commit d6438e8

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

__tests__/unit/plots/ring-progress/index-spec.ts

+20
Original file line numberDiff line numberDiff line change
@@ -327,4 +327,24 @@ describe('ring-progress', () => {
327327
it('defaultOptions 保持从 constants 中获取', () => {
328328
expect(RingProgress.getDefaultOptions()).toEqual(DEFAULT_OPTIONS);
329329
});
330+
331+
it('z-index', () => {
332+
const ringProgress = new RingProgress(createDiv(), {
333+
radius: 1,
334+
innerRadius: 0.5,
335+
width: 200,
336+
height: 100,
337+
percent: 0.6,
338+
autoFit: false,
339+
});
340+
341+
ringProgress.render();
342+
let elements = ringProgress.chart.geometries[0].elements;
343+
expect(elements[0].shape.get('zIndex')).toBeGreaterThan(elements[1].shape.get('zIndex'));
344+
ringProgress.changeData(0.7);
345+
elements = ringProgress.chart.geometries[0].elements;
346+
expect(elements[0].shape.get('zIndex')).toBeGreaterThan(elements[1].shape.get('zIndex'));
347+
348+
ringProgress.destroy();
349+
});
330350
});

src/plots/progress/adaptor.ts

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ export function geometry(params: Params<ProgressOptions>): Params<ProgressOption
2828
style: progressStyle,
2929
color: isString(color) ? [color, DEFAULT_COLOR[1]] : color,
3030
},
31+
args: {
32+
zIndexReversed: true,
33+
},
3134
},
3235
});
3336

0 commit comments

Comments
 (0)