Open yummyummyummy opened 6 years ago
All the logic in done in d3.js (https://d3js.org/). There really is no way around it. You can compute some of the values (like the size) in java/android and pass them as parameters, just like you pass the "wordCloud" in MainActivity.
For example, replace change the StringBuilder to include other params, like:
sb.append("], 300)");
and in javascript, replace the hardcoded values with variables:
function wordCloud(data, cloudSize) {
var fill = d3.scale.category20();
var layout = d3.layout.cloud().size([cloudSize, cloudSize ])
...
Thank you so much. It helped me a lot
Hi I am trying to attach d3 word cloud in my android app. To support many kinds of android devices, I wanna optimize the word cloud's size programmatically. Also, fontSize and color of each words. Can you give me any hints? I am not really familiar with js so it is very difficult for me. Thank you.