equal
deleted
inserted
replaced
18 } |
18 } |
19 |
19 |
20 }).on('init'), |
20 }).on('init'), |
21 |
21 |
22 didRender: function() { |
22 didRender: function() { |
|
23 var previousDiv = d3.selectAll(".discourses"); |
23 var self = this; |
24 var self = this; |
24 |
25 |
25 var discourses = this.get('discourses'); |
26 var discourses = this.get('discourses'); |
26 var array = discourses.map(function (d) { return d.get('count'); }); |
27 var array = discourses.map(function (d) { return d.get('count'); }); |
27 var oldMin = Math.min(...array), |
28 var oldMin = Math.min(...array), |
40 .value(function(d){ |
41 .value(function(d){ |
41 return Math.floor((((d.value - oldMin) * (newMax - newMin)) / (oldMax - oldMin)) + newMin); |
42 return Math.floor((((d.value - oldMin) * (newMax - newMin)) / (oldMax - oldMin)) + newMin); |
42 }) |
43 }) |
43 .padding(10); |
44 .padding(10); |
44 |
45 |
45 var element = d3.select('#' + self.get('elementId')); |
46 var element = d3.select('#' + self.get('elementId')) |
|
47 .append('div') |
|
48 .attr('class','discourses') |
|
49 .style('position','absolute') |
|
50 .style('left', -100000); |
46 |
51 |
47 var bubbles = bubble.nodes(self.createNodes()); |
52 var bubbles = bubble.nodes(self.createNodes()); |
48 |
53 |
49 var nodes = element |
54 var nodes = element |
50 .selectAll() |
55 .selectAll() |
69 item.append("span") |
74 item.append("span") |
70 .html(function(d) { return d.name + ' <span class="count">(' + d.count + ')</span>'; }) |
75 .html(function(d) { return d.name + ' <span class="count">(' + d.count + ')</span>'; }) |
71 .style("margin-left", function() { return ( Ember.$(this).width() > Ember.$(this).parent().width() ? - ( Ember.$(this).width() / 2 ) + ( Ember.$(this).parent().width() / 2 ) : 0 ) + 'px'; }) |
76 .style("margin-left", function() { return ( Ember.$(this).width() > Ember.$(this).parent().width() ? - ( Ember.$(this).width() / 2 ) + ( Ember.$(this).parent().width() / 2 ) : 0 ) + 'px'; }) |
72 .style("margin-top", function() { return Ember.$(this).parent().height() / 2 - Ember.$(this).height() / 2 + 'px'; }); |
77 .style("margin-top", function() { return Ember.$(this).parent().height() / 2 - Ember.$(this).height() / 2 + 'px'; }); |
73 |
78 |
|
79 previousDiv.remove(); |
|
80 element.style('position',null).style('left',null); |
|
81 |
74 this._super(...arguments); |
82 this._super(...arguments); |
75 }, |
83 }, |
76 |
84 |
77 createNodes: function() { |
85 createNodes: function() { |
78 var self = this; |
86 var self = this; |