Closed UttamRahane closed 3 years ago
@UttamRahane , we can do this post distribution of weight.
To generate heatmap, the weight of each point is distributed to all the neighboring pixels within a given radius using, a gaussian KDE (kernel density estimation). Points closer to it get higher weight , while points further away get much smaller weight.
After above step, the weights that a point gets (from all other points) is aggregated to generate the final color. At this point, aggregation is done using SUM . But we can customize this to be a max value (we can support, min and mean too), but right now there is no public API.
Does this serve your use case?
For experimenting you can make flollowing change to this line link
change blendEquation: GL.FUNC_ADD
to blendEquation: GL.MAX
Closing due to in activity, please re-open for any un-resolved questions.
Hello @1chandu,
I am interested in the solution you propose - we use heatmaps for visualising current sensor measurement values in relation to the sensors min, max and on a color scale. So the sensors do not infer each other based on geolocation, but show raw values - if it would be possible to add a public way to change these settings, we would be grateful!
@CaptainMack Hey! Have you found a solution?
@CaptainMack @Yankovsky Thanks for your input. For timely response from a team member, do not reply to closed issues in the future. We do not monitor them.
After above step, the weights that a point gets (from all other points) is aggregated to generate the final color. At this point, aggregation is done using SUM . But we can customize this to be a max value (we can support, min and mean too), but right now there is no public API. Does this serve your use case? For experimenting you can make flollowing change to this line link change
blendEquation: GL.FUNC_ADD
toblendEquation: GL.MAX
I tried to change blendEquation to GL.MAX as @1chandu suggested, but points stopped clustering: And changing to GL.MIN made all points disappear. Also there's no GL.MEAN or similar constant to use.
@nekitk You can try 8.4.0-alpha.1
with the new aggregation
prop:
new HeatmapLayer({
...
aggregation: 'MEAN' // 'SUM' or 'MEAN'
})
@Pessimistress thanks! just what we needed
@Pessimistress one clarification though. I have an array of points with different weights. It may be that all of the points values are below desired maximum value. How can I set a minimum and maximum values for weight?
For example, I want to set weights range to [0, 10]
. So even if a maximum weight between points is 5 it will be half of the maximum color.
I tried to set colorDomain: [0, 10]
, but all my points were colored as maximum color regardless of their weight:
I think I can overcome this by modifying colorRange
dynamically, but I wonder if there'e a better way.
I'm not sure I understand what you're trying to achieve. Can you create a codepen?
ok, I'll open another issue
Generally in Heatmap, If wight is 10 for a point then it would be equivalent to having 10 points of weight 1 in the same spot.so it do the summation of nearest point. Can I take max value from those points not summation. ex. suppose I have given color range from yellow to red. and there are 10 points each having weight less than 5. there is one more point which is not close to those 10 points. and that point has weight 8. so the point having value 10 should be red and other 10 points are on the same point should look yellow.