antvis/G2

[Feat]: 请教一下,词云展示一个数据量为1000+的数据,导致页面卡顿,请问是正常现象吗,以及有没有好的解决方式呀 #6618

3764446961 posted onGitHub

Describe the feature / 功能描述

词云数据量超过1000时,导致卡顿

Are you willing to contribute? / 是否愿意参与贡献?

Please select / 请选择


在使用词云展示大量数据时,页面卡顿是一个常见的问题,尤其是当数据量超过1000时。以下是一些可能的解决方案,可以帮助您优化性能:

  1. 数据预处理:在将数据传递给词云之前,尝试对数据进行预处理。可以通过去除不必要的数据或合并相似的数据来减少数据量。

  2. 按需加载:利用按需加载的技术,减少初始加载的数据量。可以通过分页或懒加载的方式逐步加载数据。

  3. 优化布局算法:调整词云的布局算法,例如使用矩形螺旋(rectangular spiral)而不是阿基米德螺旋(archimedean spiral),这可能会提高性能。

  4. 减少图形复杂度:通过减少字体大小变化或限制旋转角度来降低图形的复杂度。

  5. 使用Web Worker:将计算密集型任务移到Web Worker中,以避免阻塞主线程。

  6. 图形库优化:确保使用的是最新版本的图形库,因为新版本通常会包含性能优化。

这些方法可以帮助您在展示大量数据时提高词云的性能。

如果您有其他问题或需要进一步的帮助,请随时告诉我。

<details> <summary>🪧 Tips</summary> For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me. </details>

posted by petercat-assistant[bot] about 2 months ago

能提供一个复现的demo吗,我本地测试1000条LCP大概为5.96s

Image

posted by interstellarmt about 2 months ago

能提供一个复现的demo吗,我本地测试1000条LCP大概为5.96s

Image

和spiral有关系,spiral为rectangular时会慢很多,spiral设置为archimedean或不设置时几乎不会卡顿

posted by 3764446961 about 2 months ago

rectangular通过矩形网格进行碰撞检测,每多一个词都要多计算一次,当词语数量多或权重差异大时,碰撞检测计算量指数级增长,导致卡顿,大数据量下建议spiral设置为archimedean或保持默认。

posted by interstellarmt about 2 months ago

⚠️ This issue has been automatically closed due to inactivity.

  • If the issue is still relevant and important to you, feel free to:
    1. Reopen with additional information
    2. Create a new issue with updated context
    3. Reference any related issues or discussions

We close inactive issues to keep our backlog manageable and focused on active issues.

Your contribution makes our project better! 🌟


⚠️ 由于长期无活动,此 issue 已被自动关闭。

  • 如果这个问题对您来说仍然重要,您可以:
    1. 重新打开并提供补充信息
    2. 创建一个新的 issue 并更新相关背景
    3. 关联相关的 issue 或讨论

为了更好地维护项目,我们需要定期清理不活跃的问题。

感谢您为开源添砖加瓦!🌟

posted by github-actions[bot] about 2 months ago

Fund this Issue

$0.00
Funded

Pull requests