jasondavies / d3-cloud

Create word clouds in JavaScript.
https://www.jasondavies.com/wordcloud/
Other
3.82k stars 1.07k forks source link

Word cloud example uses wrong angles on first draw #94

Closed suterma closed 8 years ago

suterma commented 8 years ago

I am looking at this excellent piece of work.

However, using the example at https://www.jasondavies.com/wordcloud/ there is a bug. When initially loading the page, the word angles seem to go from -90 to +60 degrees, although the text boxes say -60 to 60. You can determine this on the fact that there are some words totally vertical.

When hitting "Go" without any other changes, the cloud gets recomputed with the angles in the range as expected.

It seems, that the textbox values are not correctly considered at page load.

suterma commented 8 years ago

This seems to be related with some settings in conjunction with the angles display. When I comment out

//,
        //d3.select("#angle-count").property("value", c),
        //d3.select("#angle-from").property("value", u),
        //d3.select("#angle-to").property("value", i)

it works after initial page load. Probably this breaks other stuff, but this probably gives a hint about the underlying problem.

JTFouquier commented 8 years ago

Hi there. I just ran into this issue @suterma.... I added a pause and "re clicked" the button, and it solved this issue for me. You don't notice the "reload". Maybe you can use this.

script.
  $( document ).ready(function() {
      setTimeout(
        function()
        {
          $('#go').click();
        }, 5);
  });