From 6b6ac715f5cd39de3f34967df610a03eeebe93b2 Mon Sep 17 00:00:00 2001 From: Visiky <736929286@qq.com> Date: Thu, 9 Sep 2021 17:56:02 +0800 Subject: [PATCH] chore: v2.3.33 & changelog (#2841) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: v2.3.33 & changelog * chore: 更新 changelog * docs: 更新公告 * fix: 修复空对象读取 * fix: 修复双轴图 legend 配置 --- CHANGELOG.md | 35 +++++++++++++++++++++++++++ examples/case/advanced/demo/meta.json | 4 --- gatsby-config.js | 4 +-- package.json | 4 +-- src/index.ts | 2 +- src/plots/dual-axes/adaptor.ts | 10 +++++--- src/plots/dual-axes/util/legend.ts | 5 +++- 7 files changed, 50 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7356003177..9cfe608cbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,38 @@ +#### 2.3.33 (2021-09-09) + +##### Documentation Changes + +* set default lang=zh in readme ([#2839](https://github.com/antvis/g2plot/pull/2839)) ([6c2fea3b](https://github.com/antvis/g2plot/commit/6c2fea3bb90add6ff0aff7a4ccd656c7f0b82a28)) +* **annotations:** annotations 相关文档完善 ([#2823](https://github.com/antvis/g2plot/pull/2823)) ([0df46052](https://github.com/antvis/g2plot/commit/0df46052724a0c98b75e0923ebe7c9474d7ae000)) +* **pattern:** 添加自定义 pattern 的 demo ([a0a42420](https://github.com/antvis/g2plot/commit/a0a4242038782b790b628a3668b09233e899a90f)) + +##### New Features + +* **venn:** 初始化韦恩图 ([#2831](https://github.com/antvis/g2plot/pull/2831)) ([e2b84c6a](https://github.com/antvis/g2plot/commit/e2b84c6a153831f09171b68759738ba6115a3814)) +* **dual-axes:** 双轴图支持单轴配置 legend ([#2840](https://github.com/antvis/g2plot/pull/2840)) ([d1e1a527](https://github.com/antvis/g2plot/commit/d1e1a527a046076daf06d96088f28ec19fc415bc)) +* **annotations:** 提供更新图标标注方法 ([#2826](https://github.com/antvis/g2plot/pull/2826)) ([d879ad14](https://github.com/antvis/g2plot/commit/d879ad14c516fe6a27ac6cb0d3075f5c1ebb4b39)) + +##### Bug Fixes + +* 修复 demo ([87ae90f9](https://github.com/antvis/g2plot/commit/87ae90f9c034f728222fcc0d4e7437352cc28e8f)) + +#### 2.3.33 (2021-09-09) + +##### Documentation Changes + +* set default lang=zh in readme ([#2839](https://github.com/antvis/g2plot/pull/2839)) ([6c2fea3b](https://github.com/antvis/g2plot/commit/6c2fea3bb90add6ff0aff7a4ccd656c7f0b82a28)) +* **annotations:** annotations 相关文档完善 ([#2823](https://github.com/antvis/g2plot/pull/2823)) ([0df46052](https://github.com/antvis/g2plot/commit/0df46052724a0c98b75e0923ebe7c9474d7ae000)) +* **pattern:** 添加自定义 pattern 的 demo ([a0a42420](https://github.com/antvis/g2plot/commit/a0a4242038782b790b628a3668b09233e899a90f)) + +##### New Features + +* **dual-axes:** 双轴图支持单轴配置 legend ([#2840](https://github.com/antvis/g2plot/pull/2840)) ([d1e1a527](https://github.com/antvis/g2plot/commit/d1e1a527a046076daf06d96088f28ec19fc415bc)) +* 提供更新图标标注方法 ([#2826](https://github.com/antvis/g2plot/pull/2826)) ([d879ad14](https://github.com/antvis/g2plot/commit/d879ad14c516fe6a27ac6cb0d3075f5c1ebb4b39)) + +##### Bug Fixes + +* 修复 demo ([87ae90f9](https://github.com/antvis/g2plot/commit/87ae90f9c034f728222fcc0d4e7437352cc28e8f)) + #### 2.3.32 (2021-08-25) ##### Documentation Changes diff --git a/examples/case/advanced/demo/meta.json b/examples/case/advanced/demo/meta.json index dd4a24bce3..c59b6b3fc3 100644 --- a/examples/case/advanced/demo/meta.json +++ b/examples/case/advanced/demo/meta.json @@ -10,7 +10,6 @@ "zh": "联动 Tooltip (饼图)", "en": "Associate Tooltip for Pie plot" }, - "new": true, "screenshot": "https://gw.alipayobjects.com/zos/antfincdn/VoiPvFL%26U5/pie-tooltip.gif" }, { @@ -19,7 +18,6 @@ "zh": "联动筛选", "en": "Associate Filter" }, - "new": true, "screenshot": "https://gw.alipayobjects.com/zos/antfincdn/tHF3bgalmB/association-filter.gif" }, { @@ -28,7 +26,6 @@ "zh": "带跳转转化分析图", "en": "Conversion analysis bar" }, - "new": true, "screenshot": "https://gw.alipayobjects.com/zos/antfincdn/p8r96Xc9o0/conversion-analysis-bar.gif" }, { @@ -37,7 +34,6 @@ "zh": "带跳转转化分析图2", "en": "Conversion analysis bar2" }, - "new": true, "screenshot": "https://gw.alipayobjects.com/zos/antfincdn/PojoRGFBN4/conversion-analysis-2.gif" } ] diff --git a/gatsby-config.js b/gatsby-config.js index 740a1fb2ce..59037ba8b7 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -313,8 +313,8 @@ module.exports = { indexName: 'antv_g2plot', }, announcement: { - zh: "G2Plot 8月迭代更新详情,见:https://www.yuque.com/antv/g2plot/2021-08", - en: "G2Plot 8月迭代更新详情,见:https://www.yuque.com/antv/g2plot/2021-08" + zh: "G2Plot 韦恩图上新,欢迎到【图表示例】页查看。", + en: "Venn Plot of G2Plot on the new, welcome to see details on the [Examples]" } }, }; diff --git a/package.json b/package.json index 4fbc5b248c..8f4f9e3f77 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g2plot", - "version": "2.3.32", + "version": "2.3.33", "description": "An interactive and responsive charting library", "keywords": [ "chart", @@ -144,7 +144,7 @@ "limit-size": [ { "path": "dist/g2plot.min.js", - "limit": "985 Kb" + "limit": "980 Kb" }, { "path": "dist/g2plot.min.js", diff --git a/src/index.ts b/src/index.ts index c6321d303f..de5e71df4e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -export const version = '2.3.32'; +export const version = '2.3.33'; // G2 自定义能力透出 import * as G2 from '@antv/g2'; diff --git a/src/plots/dual-axes/adaptor.ts b/src/plots/dual-axes/adaptor.ts index c0b4311d1f..ff3aad5608 100644 --- a/src/plots/dual-axes/adaptor.ts +++ b/src/plots/dual-axes/adaptor.ts @@ -367,6 +367,8 @@ export function legend(params: Params): Params } else if (isObject(legend) && legend.custom === true) { chart.legend(legend); } else { + const leftLegend = get(geometryOptions, [0, 'legend'], legend); + const rightLegend = get(geometryOptions, [1, 'legend'], legend); // 均使用自定义图例 chart.once('beforepaint', () => { const leftItems = data[0].length @@ -374,7 +376,7 @@ export function legend(params: Params): Params view: leftView, geometryOption: geometryOptions[0], yField: yField[0], - legend: geometryOptions[0].legend || legend, + legend: leftLegend, }) : []; @@ -383,7 +385,7 @@ export function legend(params: Params): Params view: rightView, geometryOption: geometryOptions[1], yField: yField[1], - legend: geometryOptions[1].legend || legend, + legend: rightLegend, }) : []; @@ -398,10 +400,10 @@ export function legend(params: Params): Params }); if (geometryOptions[0].seriesField) { - leftView.legend(geometryOptions[0].seriesField, legend); + leftView.legend(geometryOptions[0].seriesField, leftLegend); } if (geometryOptions[1].seriesField) { - rightView.legend(geometryOptions[1].seriesField, legend); + rightView.legend(geometryOptions[1].seriesField, rightLegend); } // 自定义图例交互 diff --git a/src/plots/dual-axes/util/legend.ts b/src/plots/dual-axes/util/legend.ts index bf9b2e8977..062dd0dfe1 100644 --- a/src/plots/dual-axes/util/legend.ts +++ b/src/plots/dual-axes/util/legend.ts @@ -23,7 +23,10 @@ export function getViewLegendItems(params: { const legendItemName = get(view, `options.scales.${yField}.alias`) || yField; // 返回 g2 设置的图例 const colorAttribute = geometry.getAttribute('color'); - const color = Util.getMappingValue(colorAttribute, legendItemName, colorAttribute.values[0]); + let color = view.getTheme().defaultColor; + if (colorAttribute) { + color = Util.getMappingValue(colorAttribute, legendItemName, get(colorAttribute, ['values', 0], color)); + } const marker = (isFunction(userMarker)