rawgraphs / rawgraphs-charts

A curated selection of charts provided through RAWGraphs interface
https://rawgraphs.io/
Apache License 2.0
92 stars 43 forks source link

Incorrect sizing of elements in a Voronoi Treemap #121

Closed davidejmancino closed 1 year ago

davidejmancino commented 2 years ago

Hello,

I am trying to create a Voronoi Treemap of some population data in Italian cities but I believe Raw is not showing the data properly. Many elements are not proportional as they should, and as you can see in the example cities with values of 1-5 have roughly the same size as others sized ~50.

Here is a screenshot:

immagine

The issue arises with Raw version 2.0 in Firefox 102 and Chrome 103 on Windows 10, and from other people with different computers.

Attached is the Raw project file to reproduce the issue

centro-test.zip

If there's any additional info you might need please let me know.

mikima commented 2 years ago

Sizes are actually incorrect. That is due to the iterative approach of voronoi treemaps - it is computed several times to get as close as possible to the real values.

We should expose the convergenceRatio and maxIterationCount values: https://github.com/Kcnarf/d3-voronoi-treemap#voronoiTreemap_convergenceRatio

davidejmancino commented 2 years ago

Thanks for the quick answer, mikima! If you think more iterations would get the shapes closer to the actual values perhaps it could be a good idea to add an option to increase the number of iterations

mikima commented 2 years ago

after some testing, it seems that the minWeightRatio is the best property to be used. will be added in next release.