wordCloud = () => {
let r = d3
.scaleSqrt()
.range([0, 30])
.nice();
let x = d3.scaleLog().range([0, width]);
function me(selection) {
r.domain([0, d3.max(selection.datum(), d => d.met)]);
x.domain([0.00001, d3.max(selection.datum(), d => d.met)]);
console.log(x.domain());
const bubbles = selection
.selectAll('g.bubble')
.data(selection.datum())
.join("g")
.attr('class', 'bubble')
.attr(
'transform',
d => `translate(${x(d.met)},${(Math.random() * width) / 10})`
);
bubbles
.append('circle')
.attr('r', d => r(d.met))
.attr('fill-opacity', 0.3)
.attr('fill', 'red')
.attr('stroke', 'red')
.attr('stroke-width', 1);
}
return me;
}