Skip to content

Commit

Permalink
fix: mark background legend loss (#2350)
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfu1 authored Jan 9, 2024
1 parent 04eb944 commit 2ef8895
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"ci:version": "pnpm changeset version",
"add:changelog": "pnpm changeset",
"before:release": "pnpm run build",
"release": "pnpm publish --no-git-checks -r --registry=https://registry.npmjs.org --filter @ant-design/*",
"release": "pnpm run before:release && pnpm publish --no-git-checks -r --registry=https://registry.npmjs.org --filter @ant-design/*",
"release:alpha": "pnpm publish --tag alpha --no-git-checks -r --filter @ant-design/*",
"release:beta": "pnpm publish --tag beta --no-git-checks -r --filter @ant-design/*"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/plots/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
## 2.1.8
## 2.1.7

`2024-01-09`

- 🐞 修复 `markBackground` legend 失效
- 🐞 修复 `transform` 转换逻辑错误

## 2.1.6
Expand Down
2 changes: 1 addition & 1 deletion packages/plots/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ant-design/plots",
"version": "2.1.7",
"version": "2.1.8",
"description": "G2Plot Statistical chart",
"bugs": {
"url": "https://github.com/ant-design/ant-design-charts/issues"
Expand Down
7 changes: 3 additions & 4 deletions packages/plots/src/core/plots/bar/adaptor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mark } from '../../adaptor';
import type { Adaptor } from '../../types';
import { flow, transformOptions, get, isArray, set } from '../../utils';
import { flow, transformOptions, get, isArray, set, omit } from '../../utils';
import type { BarOptions } from './type';

type Params = Adaptor<BarOptions>;
Expand All @@ -22,13 +22,13 @@ export function adaptor(params: Params) {
if (get(options, 'children.length') > 1) {
set(options, 'children', [{ type: 'interval' }]);
}
const { scale, markBackground, data, children } = options;
const { scale, markBackground, data, children, yField } = options;
const domain = get(scale, 'y.domain', []);
if (markBackground && domain.length && isArray(data)) {
const domainMax = 'domainMax';
const backgroundData = data.map((item) => {
return {
...item,
...omit(item, yField),
[domainMax]: domain[domain.length - 1],
};
});
Expand All @@ -37,7 +37,6 @@ export function adaptor(params: Params) {
data: backgroundData,
yField: domainMax,
tooltip: false,
legend: false,
style: {
fill: '#eee',
},
Expand Down
1 change: 0 additions & 1 deletion site/CNAME

This file was deleted.

0 comments on commit 2ef8895

Please sign in to comment.