Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(liquid): annotation width #2418

Merged
merged 2 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions __tests__/unit/plots/liquid/liquid-shape-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ describe('liquid', () => {
liquid.render();
expect(getClipPath(liquid)).toEqual(shapes[3].clipPath);

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

Expand Down
2 changes: 1 addition & 1 deletion __tests__/unit/plots/liquid/statistic-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('liquid statistic', () => {
it('customHtml 容器的宽度', () => {
let htmlAnnotations = document.querySelectorAll('.g2-html-annotation');
// @ts-ignore
const circleShape = liquid.chart.geometries[0].elements[0].shape.find((s) => s.get('type') === 'path');
const circleShape = liquid.chart.geometries[0].elements[0].shape.find((s) => s.get('name') === 'wrap');
expect(htmlAnnotations[0].getBoundingClientRect().width).toEqual(circleShape.getCanvasBBox().width);

// 开发者可以覆盖
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g2plot",
"version": "2.3.14",
"version": "2.3.15",
"description": "An interactive and responsive charting library",
"keywords": [
"chart",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const version = '2.3.14';
export const version = '2.3.15';

// G2 自定义能力透出
import * as G2 from '@antv/g2';
Expand Down
3 changes: 2 additions & 1 deletion src/utils/statistic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ export const renderStatistic = (chart: View, options: { statistic: Statistic; pl
} else if (plotType === 'liquid') {
const liquidShape = get(view.geometries, [0, 'elements', 0, 'shape']);
if (liquidShape) {
const path = (liquidShape as IGroup).find((t) => t.get('type') === 'path');
// 获取到水波图边框大小
const path = (liquidShape as IGroup).find((t) => t.get('name') === 'wrap');
const { width } = path.getCanvasBBox();
containerW = width;
}
Expand Down