Database Reference
In-Depth Information
Listing 5.11
Creating word clouds
DrawCloud:function(words) {
var fill = d3.scale.category10();
d3.select(
"#cloudpane"
).append(
"svg"
)
.append(
"g"
)
.attr(
"transform"
,
"translate(400,400)"
)
.selectAll(
"text"
)
.data(words)
.enter().append(
"text"
)
.style(
"font-size"
, function(d) { return d.size +
"px"
;
})
.style(
"font-family"
,
"Impact"
)
.attr(
"text-anchor"
,
"middle"
)
.attr(
"transform"
, function(d) {
return
"translate("
+ [d.x, d.y] +
")rotate("
+d.
rotate +
")"
;
})
.text(function(d) { return d.text; });
}
Source: TwitterDataAnalytics/js/wordCloud.js
Fig. 5.12
Heatmap of the five topics combined with temporal information
1.
People:
protesters, people
2.
Police:
nypd, police, cops, raid
3.
Judiciary:
court, eviction, order, judge
4.
Location:
nyc, zuccotti, park
5.
Media:
press, news, media
The time and volume of usage of these topics is presented in a topic chart in
Fig.
5.12
.