GWT Wrapper for wordcloud2.js
Add AST Maven Repo
allprojects {
repositories {
...
maven { url 'https://maven.ascend-tech.us/repo' }
}
}
Add Dependency:
compile 'us.ascendtech:gwt-wordcloud2js:2.0.0'
compile 'us.ascendtech:gwt-wordcloud2js:2.0.0:sources'
Add AST Maven Repo
allprojects {
repositories {
...
maven {
url = uri("https://maven.ascend-tech.us/repo")
}
}
}
Add Dependency
compile("us.ascendtech:gwt-wordcloud2js:2.0.0")
compile("us.ascendtech:gwt-wordcloud2js:2.0.0:sources")
Add dependency to gwt.xml:
<inherits name="us.ascendtech.highcharts.Highcharts"/>
// generate data object
JsArray<JsArray<Object>> data = new JsArray<>();
for (Term term:Elements.elements(terms)) {
data.push(new JsArray<>(term.getTerm(),term.getWeight()));
}
// create options object and set the data.
WordCloud2JSOptions options=new WordCloud2JSOptions().setList(data).setFontFamily("Calibri, sans-serif").setRotateRatio(0.1);
options.setClick(item->DomGlobal.console.log(item));
options.setWeightFactor(2d);
options.setGridSize(18d);
options.setDrawOutOfBound(false);
options.setShrinkToFit(true);
new WordCloud2JS(elementId,options);
Please check out the gwt-examples project for a working example.