选择标签云的字体大小 (rails3)
我想根据评级设置标签的字体大小。这就是我的样本评级:
206 82 25 24 25 19 8 5 0 3 2 1 6 1 1 0 32 6 3 -1 112 31 6 8 2 24 18 2 2 1
1 1 2 6 67 35 37 25 0 1 7 8 2 3 0 1 2 1 -2 8 19 -2 1 1 -3 -4 6 1 1 8 11 3
1 3 1 2 5 1 0 1 1 2 2 2 1 2 2 1 1 1 1 1 0 1 1 2 1 2 1 1 0 1 1 2 1 1 1 1 1
1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 -1 0 1 -1 -1 1 -1 -1 0 -5
-1 2 2
我尝试使用 k-means 聚类 (gem)但我似乎无法选择正确的质心数量,因为我的评级因情况而异。另外,我不确定要使用什么字体范围。最好的方法是什么?
I would like to set font sizes for tags based on rating. This is what my sample ratings look like:
206 82 25 24 25 19 8 5 0 3 2 1 6 1 1 0 32 6 3 -1 112 31 6 8 2 24 18 2 2 1
1 1 2 6 67 35 37 25 0 1 7 8 2 3 0 1 2 1 -2 8 19 -2 1 1 -3 -4 6 1 1 8 11 3
1 3 1 2 5 1 0 1 1 2 2 2 1 2 2 1 1 1 1 1 0 1 1 2 1 2 1 1 0 1 1 2 1 1 1 1 1
1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 -1 0 1 -1 -1 1 -1 -1 0 -5
-1 2 2
I've tried using k-means clustering (gem) but I can't seem to pick the right number of centroids because my ratings vary from case to case. Also, I'm not sure what font range to use. What's the best way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在这里,您将找到一种基于每个标签出现次数使用对数缩放的字体大小算法:
http://blogs.dekoh.com/dev/2007/10/29/choosing-a-good-font-size-variation-algorithm-for-your-tag-cloud/
Here you will find an algorithm for font sizes using logarithmic scaling based on the number of occurrences of each tag:
http://blogs.dekoh.com/dev/2007/10/29/choosing-a-good-font-size-variation-algorithm-for-your-tag-cloud/
尝试 i2ui 解决此问题:
设置标签的费率。
演示:http://jsfiddle.net/x4558/
Try i2ui for this issue:
Set up the rates for tags.
Demo: http://jsfiddle.net/x4558/