Open kermitt2 opened 7 years ago
c17b26a
Most likely better to move to another more reliable and predictable word cloud library. The one of Kibana looks very nice. See https://github.com/elastic/kibana/tree/master/src/core_plugins/tagcloud https://github.com/elastic/kibana/pull/8104
I changed the word cloud to take into account keyword frequency by scaling the font size (linear scaling). However, there are some issues with the positioning, because the dimension of cloud cannot be known in advance nor its the position in the svg canvas.
So before it was like that, same font size for all key words (17px):
Now, in general it's ok, but there's often some empty space between the inner g element and the svg canvas size that should be removed (maybe by looking at the position of the words):
It happen that for the same set of words, it can be quite good:
Or bad with cut words:
Note that for avoiding large words to be removed by the d3.cloud algorithm (see https://github.com/jasondavies/d3-cloud/issues/36), I've a bit enlarged the cloud size as compared to the svg canvas size. It's a decent compromise, but some cut words can happen from time to time. Ideally I think the cloud size should not be enlarged, but the cloud should be translated in the svg canvas in a more case-to-case manner by looking at the position of the words, and the size of the svg canvas should be adjusted to the one of the inner g element.