danielatkin / DataViz

Data Visualisation and Code Repository
0 stars 0 forks source link

Interactive bubble chart with Text inside of bubbles. Is it possible #2

Open RomanRSN opened 7 years ago

RomanRSN commented 7 years ago

Hi, it is a great chart. But I think it would be even better, if the bubbles could contain text inside (for example risk id). Cause I don't have so many data items, I would prefer to have bigger bubbles with some info inside them. Unfortunatelly if I am trying to add my own text objects like: function addTxtObjects(_nodes) { _nodes.enter().append("text") .attr("x", function(d) { return d.x; }) .attr("y", function(d) { return d.y ; }) .text(function(d){ return "my ID"; }); }

I have following Problems:

  1. It only works if I call addTxtObjects after draw(); after making an alert() or putting it in force.on("end", function() { addTxtObjects(nodes); });

But if I am doing it, the text appears only many seconds after run the Chart.

  1. Even if I have text inside within force.on('end'..) no further activity is possible. So further clicks are not working and the Chart is not sorted by another categorey etc.

I think it should be possible, but I don't have enough knowledge on d3 to do it myself.

Probably somebody or author could help me?

Thanks

RomanRSN commented 7 years ago

Hi, I have resolved the Problem. The solution was to put circles and text-elements inside of one g-element. After then to change tick() function to manipulate not .cs and .cy Attribute, but Transformation of g-element. The issue is closed. Thanks