nswamy14 / visual-heatmap

Heatmap : Open source javascript module for high performance, large scale heatmap rendering.
BSD 3-Clause "New" or "Revised" License
55 stars 10 forks source link

Adapt content to canvas width #27

Closed diebarral closed 6 months ago

diebarral commented 6 months ago

Hey!

First of all, thank you for your work on this library, it's been very useful.

I have one question, cause I'm not sure if it's possible or if there's a workaround for it. The dataset that I'm rendering on the heatmap makes everything look fairly concentrated in the center of the screen, leaving most of the canvas unused, unless I zoom in.

Is there a way to make the data occupy as much of the canvas width/height as possible, without having to zoom in?

Thanks!

nswamy14 commented 6 months ago

@diebarral, I hope I've understood your question correctly. You have two options: one is to zoom in, as you have mentioned. The other option is to recalibrate the data coordinates to fit the canvas dimensions (heatmapInstance height/width) and then render the updated data using "renderData" API.

diebarral commented 6 months ago

It sounds more like the second option what I want to achieve, so given the width of the canvas and the content, find a "scale" factor to adjust the content to fill as much as possible the size of the rendered canvas? Correct?

nswamy14 commented 6 months ago

Correct

diebarral commented 6 months ago

Alright! Thanks for the quick response!