问题
I'm trying to convert and old d3v3 hybrid chart -- but the bubble chart elements are not working?
d3v3 - https://jsfiddle.net/jfxoy7wr/
d3v4 example v4 https://jsfiddle.net/30odhpft/
this bubble chart code - is currently commented out - it was reporting an error loading in the d3.pack()?
var bubble = d3.pack()
.size([diameter, diameter])
.value(function(d) {
return d.value;
})
.padding(3);
//_create bubble
var data = bubbledata(data);
var node = svg.selectAll(".node")
.data(bubble(nodes).descendants())
var nodes = bubble.nodes(data)
.filter(function(d) {
return !d.children;
}); // filter out the outer bubble
var bubbles = bubs.selectAll('circle')
.data(nodes);
bubbles.enter()
.insert("circle")
.attr('transform', function(d) {
return 'translate(' + d.x + ',' + d.y + ')';
})
.attr('r', function(d) {
return d.r;
})
.style("fill", function(d) {
return colores_google(d.groupid);
});
bubbles = bubbles.transition()
.transition()
.duration(250)
.attr('transform', function(d) {
return 'translate(' + d.x + ',' + d.y + ')';
})
.attr('r', function(d) {
return d.r;
})
.ease('sine');
来源:https://stackoverflow.com/questions/62111863/d3v4-hybrid-dougnut-and-bubble-chart-but-the-bubbles-arent-working