diff --git a/docs/assets/changelog/en/changelog.md b/docs/assets/changelog/en/changelog.md index 85ec76d09..830f86df4 100644 --- a/docs/assets/changelog/en/changelog.md +++ b/docs/assets/changelog/en/changelog.md @@ -1,3 +1,29 @@ +# v0.20.9 + +2024-10-15 + + +**🆕 New feature** + +- **@visactor/vrender-components**: support axis label `firstVisible` in autoHide and linear axis sampling +- **@visactor/vrender-components**: add `interactInvertType` for smartInvert +- **@visactor/vrender-core**: text support keep-all, closed [#1466](https://github.com/VisActor/VRender/issues/1466) + +**🐛 Bug fix** + +- **@visactor/vrender-components**: fix smartInvert when `outsideEnable` is true +- **@visactor/vrender-components**: fix max width of arc label in left +- **@visactor/vrender-components**: fix `pager.space` of discrete legend +- **@visactor/vrender-components**: fix smart invert when only has intercet width base mark +- **@visactor/vrender-components**: fix `legend.item.label.space` when has value +- **@visactor/vrender-components**: legend scroll critical value leads last page not render. fix@VisActor/VChart[#3172](https://github.com/VisActor/VRender/issues/3172) +- **@visactor/vrender-kits**: fix max width of arc label in left +- **@visactor/vrender-core**: fix max width of arc label in left + + + +[more detail about v0.20.9](https://github.com/VisActor/VRender/releases/tag/v0.20.9) + # v0.20.8 2024-09-30 diff --git a/docs/assets/changelog/zh/changelog.md b/docs/assets/changelog/zh/changelog.md index 0488ab7ab..628510c06 100644 --- a/docs/assets/changelog/zh/changelog.md +++ b/docs/assets/changelog/zh/changelog.md @@ -1,3 +1,29 @@ +# v0.20.9 + +2024-10-15 + + +**🆕 新增功能** + +- **@visactor/vrender-components**: support axis label `firstVisible` in autoHide and linear axis sampling +- **@visactor/vrender-components**: add `interactInvertType` for smartInvert +- **@visactor/vrender-core**: text support keep-all, closed [#1466](https://github.com/VisActor/VRender/issues/1466) + +**🐛 功能修复** + +- **@visactor/vrender-components**: fix smartInvert when `outsideEnable` is true +- **@visactor/vrender-components**: fix max width of arc label in left +- **@visactor/vrender-components**: fix `pager.space` of discrete legend +- **@visactor/vrender-components**: fix smart invert when only has intercet width base mark +- **@visactor/vrender-components**: fix `legend.item.label.space` when has value +- **@visactor/vrender-components**: legend scroll critical value leads last page not render. fix@VisActor/VChart[#3172](https://github.com/VisActor/VRender/issues/3172) +- **@visactor/vrender-kits**: fix max width of arc label in left +- **@visactor/vrender-core**: fix max width of arc label in left + + + +[更多详情请查看 v0.20.9](https://github.com/VisActor/VRender/releases/tag/v0.20.9) + # v0.20.8 2024-09-30 diff --git a/packages/vrender-components/src/axis/overlap/auto-hide.ts b/packages/vrender-components/src/axis/overlap/auto-hide.ts index d94534e35..6e42555f5 100644 --- a/packages/vrender-components/src/axis/overlap/auto-hide.ts +++ b/packages/vrender-components/src/axis/overlap/auto-hide.ts @@ -105,19 +105,21 @@ export function autoHide(labels: IText[], config: HideConfig) { do { items = reduce(items, sep); } while (items.length >= 3 && hasOverlap(items, sep)); - /** - * 0.17.10 之前,当最后label个数小于3 的时候,才做最后的label强制显示的策略 - */ - const shouldCheck = (length: number, visibility: boolean) => length < 3 || visibility; + const shouldCheck = (length: number, visibility: boolean, checkLength: boolean = true) => { + return checkLength ? length < 3 || visibility : visibility; + }; - const checkFirst = shouldCheck(items.length, config.firstVisible); + const checkFirst = shouldCheck(items.length, config.firstVisible, false); + /** + * 0.17.10 之前,当最后 label 个数小于 3 的时候,才做最后的label强制显示的策略 + */ let checkLast = shouldCheck(items.length, config.lastVisible); const firstSourceItem = source[0]; const lastSourceItem = last(source); - if (intersect(firstSourceItem, lastSourceItem, sep)) { + if (intersect(firstSourceItem, lastSourceItem, sep) && checkFirst && checkLast) { lastSourceItem.setAttribute('opacity', 0); // Or firstSourceItem, depending on preference checkLast = false; } diff --git a/packages/vrender-components/src/axis/tick-data/continuous.ts b/packages/vrender-components/src/axis/tick-data/continuous.ts index a92fd9541..b1435d6d5 100644 --- a/packages/vrender-components/src/axis/tick-data/continuous.ts +++ b/packages/vrender-components/src/axis/tick-data/continuous.ts @@ -158,13 +158,11 @@ export const continuousTicks = (scale: ContinuousScale, op: ITickDataOpt): ITick items = samplingMethod(items, labelGap); } - const shouldCheck = (length: number, visibility: boolean) => length < 3 || visibility; - - const checkFirst = shouldCheck(items.length, op.labelFirstVisible); - let checkLast = shouldCheck(items.length, op.labelLastVisible); + const checkFirst = op.labelFirstVisible; + let checkLast = op.labelLastVisible; // 这里和 auto-hide 里的逻辑有差异,不根据 length 自动强制显示最后一个(会引起 vtable 较多 badcase)。 if (intersect(firstSourceItem as any, lastSourceItem as any, labelGap)) { - if (items.includes(lastSourceItem) && items.length > 1) { + if (items.includes(lastSourceItem) && items.length > 1 && checkFirst && checkLast) { items.splice(items.indexOf(lastSourceItem), 1); checkLast = false; }