Skip to content
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
26 changes: 26 additions & 0 deletions docs/assets/changelog/en/changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
26 changes: 26 additions & 0 deletions docs/assets/changelog/zh/changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 8 additions & 6 deletions packages/vrender-components/src/axis/overlap/auto-hide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 3 additions & 5 deletions packages/vrender-components/src/axis/tick-data/continuous.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down