-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
5.2.8版本热力图无法渲染 #6512
Comments
me too |
和 #6510 这个是相同的问题吗? |
https://g2.antv.antgroup.com/examples/general/heatmap/#heatmap 官网 DEMO 打开是可行的,可以提供一个 codesandbox 的在线示例,我来调试一下。 |
|
|
似乎 5.1.17 可以 5.1.18 就不行了 5.1.18 升级成 @antv/g ^6.0.0 版本 升级的东西很多 新手表示根本不知道问题所在 |
最新测试 定位到如下 组件 组件下 @antv/g-canvas 2.0.17 版本不行 2.0.16 版本可以 组件下 @antv/g-plugin-canvas-renderer 2.1.1 版本不行 2.1.0 版本可以 @antv/g-plugin-canvas-renderer 2.1.1 依赖 与 2.1.0 依赖有几处不同 降级不起作用 同时 @antv/g-plugin-canvas-renderer 2.1.0 升级为 报错如下 目前定位到 @antv/g-plugin-canvas-renderer 2.1.0 升级到 2.1.1 的代码 调用 "@antv/g-lite": "2.1.1" 时有问题 同时 依赖多添加了 "@babel/runtime": "^7.25.6", 可能也能找到相关的调用 才开始接触vue 和 antv 以前对前端一窍不通,完全是抛砖引玉 |
@Hideinvirus @xiaoiver @hustcc 帮忙看一下 是不是 这个问题 @antv/g-plugin-canvas-renderer 修改 Images.ts 代码如下 测试后发现 前端正常 渲染 并显示 之前代码 显示 官网 案例 链接 https://g2.antv.antgroup.com/examples#general-heatmap 原因 似乎是 传入的 src 为 canvas 标签 经处理后 变成了 undefined 然后 退出了 而 2.1.0 似乎是 |
似乎 可以 终章了 如 不修改 @antv/g-plugin-canvas-renderer 2.1.1 Image.ts 代码 修改 原因似乎是 因为 百度得知 canvas 标签没有 src 和 alt 属性 通过控制台打印 src 得到 那么 请大佬们 稍微关注一下 好像试过 用vue2 能正常显示 怀疑此处代码 @antv/g-plugin-image-loader 2.1.11 ImagePool.ts 在此处代码 与 2.0.12 版本代码一致 请各位大佬百忙之中 抽出一点时间来看一下吧 |
@8502596 已经分析到这个地步了, 直接来一个 PR 吧。我看你也在 G 提了 issue:antvis/G#1864 |
@hustcc 真不会提 😟 真的抱歉,对前端一窍不通 都不知道自己写的对不对 只是瞎写的。 |
厉害啊,问题的原因你这边已经分析出来了,是因为底层升级时未考虑到 Image 元素的 G2 中的关键代码: export const Heatmap: SC<HeatmapOptions> = (options, context) => {
// ...
return (points: number[][], value, defaults) => {
return select(document.createElement('image', {}))
.call(applyStyle, defaults)
.style('x', 0)
.style('y', 0)
.style('width', width)
.style('height', height)
.style('src', ctx.canvas)
.style('transform', transform)
.call(applyStyle, style)
.node();
}
} 其中,通过 |
是不是这里改成传入 dataUrl 就可以了?如果可以的话,直接 G2 改掉也合理,G 层不做适配。 |
可以的,这样可能更符合规范标准,合理一些 |
问题描述
@antv/g2版本^5.2.8,出现热力区域无法渲染的问题

重现链接
No response
重现步骤
vue3项目,安装最新版本g2,复制官网热力图示例,图片正常展示,热力区域无法显示
预期行为
No response
平台
屏幕截图或视频(可选)
补充说明(可选)
No response
The text was updated successfully, but these errors were encountered: