Skip to content

feat:update venn layout algorithm #239

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

Merged
merged 11 commits into from
Jun 27, 2025
Merged

Conversation

afkdsghk211331
Copy link
Contributor

@afkdsghk211331 afkdsghk211331 commented May 14, 2025

🤔 这个分支是...

  • 新功能
  • Bug fix
  • Ts 类型更新
  • 打包优化
  • 性能优化
  • 功能增强
  • 重构
  • 依赖版本更新
  • 代码优化
  • 测试 case 更新
  • 分支合并
  • 网站/文档更新
  • demo 更新
  • Workflow
  • 配置修改
  • 其他 (具体是什么,请补充?)

🔗 相关 issue 连接

#238

💡 问题的背景&解决方案

📝 Changelog

Venn 图处理增强:

更新了 transform 函数,使其能够处理 sets 字段为空的情况,通过返回具有计算半径和中心的默认圆形来确保空集在 Venn 图中能正确表示
修改了 computeTextCenters 函数,使其能处理包含空集的区域,为这些区域分配默认中心点 (0, 0)

实用函数改进:

增强了 intersectionArea 函数,使其能处理输入 circles 数组为空的情况,通过在 stats 对象中设置默认值并返回面积为 0

测试覆盖:

添加了新的测试用例"具有空集的 3 元素 Venn 图的数据转换",以验证 Venn 图转换中空集的正确处理

元数据更新:

添加了变更文件,记录了 @visactor/vlayouts 和 @visactor/vutils 版本 1.0.5 的发布

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ 自测

⚠️ 在提交 PR 之前,请检查一下内容. ⚠️

  • 文档提供了,或者更新,或者不需要
  • Demo 提供了,或者更新,或者不需要
  • Ts 类型定义提供了,或者更新,或者不需要
  • Changelog 提供了,或者不需要

🚀 Summary

更新transform算法,使得sets为空时返回一个表示含有剩余值的底层大圆。同时,在label.ts和circle-intersection.ts 中增加对边界状况的处理

🔍 Walkthrough

copilot:walkthrough

@afkdsghk211331 afkdsghk211331 changed the title docs: update changlog of rush feat:update venn layout algorithm May 14, 2025
@afkdsghk211331 afkdsghk211331 marked this pull request as ready for review May 15, 2025 03:28
@afkdsghk211331
Copy link
Contributor Author

已经按照意见改掉了

@afkdsghk211331
Copy link
Contributor Author

image
image

目前实现效果如图,或许有更精准的半径计算方法?

@@ -23,14 +23,20 @@ export const transform = (
setField = 'sets',
valueField = 'size',
orientation = Math.PI / 2,
orientationOrder = null
orientationOrder = null,
emptySetKey = ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emptySetKey 作用是?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

按照xile的意见改的,可能我的实现对于这个配置项没什么效果

@afkdsghk211331 afkdsghk211331 requested a review from xile611 June 15, 2025 14:19
...area,
datum: area,
sets,
key: 'others',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emptySetKey 应该用在这里吧;
key 默认可以给个 others,但是options 里如果配置了 emptySetKey,应该返回 emptySetKey

{
"changes": [
{
"comment": "fix: add emptySetKey option to IVennTransformOptions",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vlayout 的 changelog 内容和 vutils 区分一下

@xiaoluoHe xiaoluoHe merged commit 880da09 into VisActor:main Jun 27, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants