chart = {
const svg = DOM.svg();
svg.setAttribute("viewBox", "-80 -50 700 350");
const profile1MinMax = d3.extent(data, d=> Math.abs(d[p]));
const profile1ColorScale = d3.scaleThreshold().domain([0]).range([colorNeg, colorPos])
const profile1Scale= d3.scaleLinear().domain(profile1MinMax).range([5,40])
const bubbleData= _.map(data, d=>{
const prColor = profile1ColorScale(d[p]);
const size = profile1Scale(Math.abs(d[p]));
const label = d.Attribute
const shapValue= d[p]
const profileNum = p
console.log(size, prColor, label)
return{
prColor,
shapValue,
size,
label,
profileNum,
}
});
console.log(bubbleData)
const bubbles= d3.select(svg)
.selectAll('g')
.data(bubbleData)
.enter()
.append('g')
.attr('transform', (d,i) =>
`translate(${(i % 5)*bubbleSize}, ${Math.floor(i/5)*bubbleSize})`)
bubbles.append('circle')
.attr('r', d=>d.size)
.attr('cx', 0)
.attr('cy', 0)
.attr('fill', d=>d.prColor)
bubbles.append("text")
.attr("x",0)
.attr("y", 50)
.attr('font-size', 10)
.attr('text-anchor', 'middle')
.text(function(d) { return d.label; })
return svg
}