antvis/G6

Graph API - 图片下载相关 #4916

Yanyan-Wang posted onGitHub

Issue Hunt 计划(可选)

  • 我同意将这个 Issue 参与 Issue Hunt 计划

Issue 难度

中难度

悬赏

请在 2023 年 9 月 30 日之前完成 PR,10 月 15 日之前完成全部 CR 意见的修改。 AntV 将支付 $15 (汇率按结算当日计)

问题描述

在 v5 实现四个 API:

  • graph.downloadImage 画布导出图片,图片仅包含画布可见区域部分内容
  • graph.downloadFullImage 导出包含全图的图片(graph 内容可能超出视口范围)
  • graph.toDataURL 返回可见区域的图的 dataUrl,用于生成图片
  • graph.toFullDataURL 返回整个图(包括超出可见区域的部分)的 dataUrl,用于生成图片

可参考 v4 实现:

需要注意:

  • G6 v4 所有图形都在一个 canvas 上。而 v5 分为主 canvas、交互层 canvas、背景 canvas。导出的图片应当包含三个图层视觉上可以看到的全部内容;
  • G6 5.0 升级了渲染引擎 @antv/g,canvas 的 API 可能有所变化,参考其官网:https://g.antv.antgroup.com/

重现链接

https://github.com/antvis/G6/blob/master/packages/pc/src/graph/graph.ts#L419

重现步骤

  1. clone g6 代码
git clone https://github.com/antvis/G6.git
  1. 拉取所有线上分支
git fetch
  1. 切换到 v5 分支
git checkout v5
  1. 进入 g6 包
cd packages/g6
  1. 安装依赖
npm install
  1. 启动 demo
npm run dev
  1. 实现功能、新增 demo 以测试

demo 位于 packages/g6/tests/integration

测试用例的编写以及测试方式参考:https://github.com/antvis/G6/pull/4793

  1. 提交代码,等待 CR

  2. 根据(多次) CR 建议修改

  3. 等待合并入 v5 分支后,管理员支付奖金

预期行为

可以通过调用 API 的方式,下载图片、或生成 url。 PR 中应包含效果截图/动图。

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]
  • G6 版本: [5.0-alpha]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response


请复制以下模板,填写相关信息,然后删除模板中的注释。 Please copy the following template, fill in the relevant information, and then delete the comments in the template.


## Issue 认领 / Issue Claim

**贡献者/Contributor**

> 例如:张三, 李四
> For example: John Smith, Sarah Johnson

**预计完成时间/Estimated Completion Date**

> 例如:2023-06-06
> For example: May 30, 2023

**联系方式/Contact Information**

> 例如:contact@email.com
> For example: contact@email.com

**其他信息/Additional Information**

> 例如:这个 issue 比预期的要复杂,我希望能获得更多的奖励
> For example: This issue is more complex than expected, and I hope to receive more reward.
posted by github-actions[bot] over 1 year ago

Issue 认领 / Issue Claim

贡献者/Contributor

fisherLLcy

预计完成时间/Estimated Completion Date

2023-09-30

联系方式/Contact Information

fisherlcy@163.com

其他信息/Additional Information 对webgl渲染的canvas混合并导出为图片要比预期的更复杂,我希望提高该issue的悬赏难度和奖励

posted by fisherLLCy over 1 year ago

Issue 认领 / Issue Claim

贡献者/Contributor

fisherLLcy

预计完成时间/Estimated Completion Date

2023-09-30

联系方式/Contact Information

fisherlcy@163.com

其他信息/Additional Information 对webgl渲染的canvas混合并导出为图片要比预期的更复杂,我希望提高该issue的悬赏难度和奖励

已更新,加油~

posted by Yanyan-Wang over 1 year ago

已经完成了,加下 PR 里面的钉钉群二维码,沟通转账信息~

posted by Yanyan-Wang over 1 year ago

已完成转账~

posted by Yanyan-Wang over 1 year ago

下载的图片没包含图例等插件图层吗?

posted by iahu over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests