dlamotte / django-tagging

Automatically exported from code.google.com/p/django-tagging
Other
0 stars 0 forks source link

Improve LOGARITHMIC cloud distribution for high min_count values #142

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Currently, when a ``min_count`` filter is used, the logarithmic
distribution doesn't work as well as it could, IMHO.

Imagine max count is 400, and min count is either filtered to be 100 (or
possibly really is 100, even without a filter).

The minimum weight of any tag in the cloud then is:

log(100) * 400 / log(400) = ~307

In a 4-step distribution, this will be font size 2 - size 1 is skipped
completely.

The linear algorithm does not have that problem, since the weights are not
modified.

I'd provide a patch, but unfortunately, my math skills fail me once again.
I managed to modify ``calculate_cloud`` so that everything is shifted down,
e.g.

max_weight = max_weight - min_weight
min_weight = 1

But that may not be the best solution. The change should probably be inside
``_calculate_tag_weight``, if possible.

Original issue reported on code.google.com by elsdoer...@gmail.com on 4 Aug 2008 at 8:19

GoogleCodeExporter commented 8 years ago
I'm having issues with this as well :)

I think it's going to be quite common among sites with thousands of items that 
are tagged

Original comment by Jim.mixt...@gmail.com on 19 Feb 2009 at 2:33