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

热力图显示有问题,麻烦大佬帮忙看一下~ #110

Open
wangxinyu666666 opened this issue Jul 15, 2021 · 2 comments
Open

热力图显示有问题,麻烦大佬帮忙看一下~ #110

wangxinyu666666 opened this issue Jul 15, 2021 · 2 comments

Comments

@wangxinyu666666
Copy link

wangxinyu666666 commented Jul 15, 2021

1.import语句
image

2.处理数据
image
最后heatData的值为:
image

3.地图组件
image

4.问题
其中不同省份的count的值差距很大,比如浙江省的count为3726081.59,新疆的count只有628,这个时候热力图上新疆那一块没有显示颜色。heatData一共有30个省份的数据,但是在地图上只显示了数值较大的省份
image
地图放大之后
image
我理解热力图就算有极端情况,不同省份数据差距很大,那些数据很小的省份应该也会有颜色显示的,所以这一块麻烦看一下,是我哪里写的有问题吗?

@Junior2Ran
Copy link
Member

如你所说,浙江省的count为3726081.59,新疆的count只有628,那么浙江的取色值的key为1.0,新疆只能到0.0,而0.0的key设置的颜色为无色,所以显示不出来

@wangxinyu666666
Copy link
Author

wangxinyu666666 commented Jul 16, 2021

如你所说,浙江省的count为3726081.59,新疆的count只有628,那么浙江的取色值的key为1.0,新疆只能到0.0,而0.0的key设置的颜色为无色,所以显示不出来

谢谢大佬回复!
@Junior2Ran
我的颜色设置是下面这样的
image

这是我的颜色设置对应到canvas的效果,不存在无色的情况鸭,是我的理解有问题吗?
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
var grd=ctx.createLinearGradient(0,0,170,0);
grd.addColorStop(0,"rgba(255,64,28,1)");
grd.addColorStop(0.1,"rgba(0,0,255,1)");
grd.addColorStop(0.2,"rgba(0,0,255,1)");
grd.addColorStop(0.6,"rgba(44,222,148,0.6)");
grd.addColorStop(0.8,"rgba(254,237,83,0.8)");
grd.addColorStop(0.9,"rgba(255,118,50,0.9)");
grd.addColorStop(1,"rgba(255,64,28,1)");
image

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

No branches or pull requests

2 participants