Skip to content

Commit 9ce38a4

Browse files
authored
fix(liquid): annotation width (#2418)
* fix(liquid): annotation width * fix: ci
1 parent d96ff8b commit 9ce38a4

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

__tests__/unit/plots/liquid/liquid-shape-spec.ts

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ describe('liquid', () => {
4242
liquid.render();
4343
expect(getClipPath(liquid)).toEqual(shapes[3].clipPath);
4444

45+
// @ts-ignore
46+
expect(liquid.chart.ele.querySelector('.g2-html-annotation').style.width).toBe('270px');
4547
liquid.destroy();
4648
});
4749

__tests__/unit/plots/liquid/statistic-spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('liquid statistic', () => {
5353
it('customHtml 容器的宽度', () => {
5454
let htmlAnnotations = document.querySelectorAll('.g2-html-annotation');
5555
// @ts-ignore
56-
const circleShape = liquid.chart.geometries[0].elements[0].shape.find((s) => s.get('type') === 'path');
56+
const circleShape = liquid.chart.geometries[0].elements[0].shape.find((s) => s.get('name') === 'wrap');
5757
expect(htmlAnnotations[0].getBoundingClientRect().width).toEqual(circleShape.getCanvasBBox().width);
5858

5959
// 开发者可以覆盖

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@antv/g2plot",
3-
"version": "2.3.14",
3+
"version": "2.3.15",
44
"description": "An interactive and responsive charting library",
55
"keywords": [
66
"chart",

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const version = '2.3.14';
1+
export const version = '2.3.15';
22

33
// G2 自定义能力透出
44
import * as G2 from '@antv/g2';

src/utils/statistic.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ export const renderStatistic = (chart: View, options: { statistic: Statistic; pl
106106
} else if (plotType === 'liquid') {
107107
const liquidShape = get(view.geometries, [0, 'elements', 0, 'shape']);
108108
if (liquidShape) {
109-
const path = (liquidShape as IGroup).find((t) => t.get('type') === 'path');
109+
// 获取到水波图边框大小
110+
const path = (liquidShape as IGroup).find((t) => t.get('name') === 'wrap');
110111
const { width } = path.getCanvasBBox();
111112
containerW = width;
112113
}

0 commit comments

Comments
 (0)