Skip to content
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

网格热力通过.source设置网格大小不生效 #2299

Open
zzrooen opened this issue Feb 20, 2024 · 5 comments
Open

网格热力通过.source设置网格大小不生效 #2299

zzrooen opened this issue Feb 20, 2024 · 5 comments
Assignees
Labels

Comments

@zzrooen
Copy link

zzrooen commented Feb 20, 2024

问题描述

  this.heatmapLayer.source(this.d, {
    parser: {
      type: "json",
      x: "lng",
      y: "lat",
    },
    transforms: [
      {
        type: "grid",
        size: this.value1,
        field: "v",
        method: "sum",
      },
    ],
  });
  this.polygonLayer.size("sum", [0, this.value1 * 4]);
  this.scene.render();

}
通过.source设置网格大小失效,试了通过.size设置网格高度是生效的,请问怎么设置网格的大小

Copy link
Contributor

Hi @zzrooen, Please star this repo if you find it useful! Thanks ⭐!
你好 @zzrooen。如果该仓库对你有用,可以 star 一下,感谢你的 ⭐!

Copy link
Contributor

hi @zzrooen, welcome!

@github-actions github-actions bot added the good first issue Good for newcomers label Feb 20, 2024
@lzxue
Copy link
Contributor

lzxue commented Feb 20, 2024

网格大小通过 transform 实现,可以看下面的demo

https://l7.antv.antgroup.com/zh/examples/heatmap/hexagon/#world

@zzrooen
Copy link
Author

zzrooen commented Feb 20, 2024

直接设置网格大小是可以的,但是想实现动态设置网格大小的功能,通过.source将transforms中的size设置为value1不生效
handleChange() {
this.polygonLayer.source(this.d, {
parser: {
type: "json",
x: "lng",
y: "lat",
},
transforms: [
{
type: "grid",
size: this.value1,
field: "v",
method: "sum",
},
],
});
this.polygonLayer.size("sum", [0, this.value1 * 4]);
this.scene.render();
}

@lzxue
Copy link
Contributor

lzxue commented Mar 15, 2024

直接设置网格大小是可以的,但是想实现动态设置网格大小的功能,通过.source将transforms中的size设置为value1不生效 handleChange() { this.polygonLayer.source(this.d, { parser: { type: "json", x: "lng", y: "lat", }, transforms: [ { type: "grid", size: this.value1, field: "v", method: "sum", }, ], }); this.polygonLayer.size("sum", [0, this.value1 * 4]); this.scene.render(); }

更新网格大小需要通过 setData 更新

@Dreammy23 Dreammy23 self-assigned this Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants