Change discourse layout to spread bubbles accross
authorChloe Laisne <chloe.laisne@gmail.com>
Sun, 02 Oct 2016 14:57:37 +0200
changeset 310 b1f9bcfda379
parent 303 2fef8007c2b2
child 311 f4327199e8f0
Change discourse layout to spread bubbles accross
cms/app-client/app/components/discourses-component.js
cms/app-client/app/styles/components/discourses-component.scss
--- a/cms/app-client/app/components/discourses-component.js	Tue Sep 27 01:50:53 2016 +0200
+++ b/cms/app-client/app/components/discourses-component.js	Sun Oct 02 14:57:37 2016 +0200
@@ -38,7 +38,7 @@
                 .value(function(d){
                     return Math.floor((((d.value - oldMin) * (newMax - newMin)) / (oldMax - oldMin)) + newMin);
                 })
-                .padding(25);
+                .padding(10);
 
             var element = d3.select('#' + self.get('elementId'));
 
@@ -75,18 +75,13 @@
 
     createNodes: function(json) {
         var self = this;
-        var nodes = {};
-        var children = {};
+        var children = [];
 
         Object.keys(json).forEach(function(key) {
             var discourse = json[key];
             var category_key = self.get('constants').DISCOURSE_CATEGORY_KEYS[key];
             var category_value = self.get('constants').DISCOURSE_CATEGORY_VALUES[category_key];
-
-            children[category_key] = children[category_key] || {};
-            children[category_key]['name'] = category_key;
-            children[category_key]['children'] = children[category_key]['children'] || [];
-            children[category_key]['children'].push({
+            children.push({
                 'id': key,
                 'name': discourse.label,
                 'value': discourse.count,
@@ -95,12 +90,7 @@
             });
         });
 
-        nodes.children = [];
-        Object.keys(children).forEach(function(key) {
-            nodes.children.push(children[key]);
-        });
-
-        return nodes;
+        return { 'children': children };
     }
 
 });
--- a/cms/app-client/app/styles/components/discourses-component.scss	Tue Sep 27 01:50:53 2016 +0200
+++ b/cms/app-client/app/styles/components/discourses-component.scss	Sun Oct 02 14:57:37 2016 +0200
@@ -1,5 +1,7 @@
 .discourses-component {
 	position: relative;
+	width: inherit;
+	height: inherit;
 }
 
 .discourses-component .item {