var d3div= "#holder_"+this.divName; var thisObj=this; $.getScript('https://my.infocaptor.com/dash/js/d3.v3.min.js', function(data, textStatus){ buildBubbles(); }); function buildBubbles() { var width = thisObj.dWidth; var height = thisObj.dHeight; var maxSize=Math.min(width,height); var diameter = maxSize, format = d3.format(",d"), color = d3.scale.category20c(); var bubble = d3.layout.pack() .sort(null) .size([diameter, diameter]) .padding(1.5); var svg = d3.select(d3div).append("svg") .attr("width", diameter) .attr("height", diameter) .attr("class", "bubble"); var data=[ glb["_odata"][0], //non-numeric data array for e.g country names glb["_odata"][1] //numeric data array for e.g sales by country ]; var dobj=[]; for (var di=0;di"+data[1][i]+" "; showToolTip(tipStr,thisObj.dx+d.x+d3.mouse(this)[0]+50,thisObj.dy+d.y+d3.mouse(this)[1],true); }) .on("mousemove", function(d,i) { tooltipDivID.css({top:thisObj.dy+d.y+d3.mouse(this)[1],left:thisObj.dx+d.x+d3.mouse(this)[0]+50}); }) .on("mouseout", function() { d3.select(this).style("fill", function(d) { return color(data[0][d.key]); }); showToolTip(" ",0,0,false); }) ; /*node.append("title") .text(function(d) { return data[0][d.key] + ": " + format(d.value); }); */ node.append("circle") .attr("r", function(d) { return d.r; }) ; //.style("fill", function(d) { return color(data[0][d.key]); }); node.append("text") .attr("dy", ".3em") .attr("font-size",thisObj.fontSize) .attr("font-family",thisObj.fontName) .style("text-anchor", "middle") .style("fill","black") .text(function(d) { return data[0][d.key].substring(0, d.r / 3); }); } //); function showToolTip(pMessage,pX,pY,pShow) { if (typeof(tooltipDivID)=="undefined") { tooltipDivID =$('
'); $('body').append(tooltipDivID); } if (!pShow) { tooltipDivID.hide(); return;} //MT.tooltipDivID.empty().append(pMessage); tooltipDivID.html(pMessage); tooltipDivID.css({top:pY,left:pX}); tooltipDivID.show(); } }