Commit 5bc002a2689f6f7fd9e937cad0dd94e4565c8860
1 parent
8afea66c
datalet refactoring
Showing
10 changed files
with
27 additions
and
12 deletions
datalets/barchart-datalet/barchart-datalet.html
datalets/base-ajax-json-jsonpath-datalet/static/js/AjaxJsonJsonPathBehavior.js
... | ... | @@ -62,11 +62,10 @@ var AjaxJsonJsonPathBehavior = { |
62 | 62 | */ |
63 | 63 | handleResponse: function(e) { |
64 | 64 | this.properties.json_results.value = e; |
65 | - this.createDataObject(); | |
66 | 65 | this.runWorkcycle(); |
67 | 66 | }, |
68 | 67 | |
69 | - createDataObject : function(){ | |
68 | + selectData : function(){ | |
70 | 69 | |
71 | 70 | this.data = []; |
72 | 71 | this._component.fields = JSON.parse(this._component.fields); | ... | ... |
datalets/base-datalet/static/js/BaseDataletBehaviors.js
... | ... | @@ -80,7 +80,6 @@ var WorkcycleBehavior = { |
80 | 80 | * @method requestData |
81 | 81 | */ |
82 | 82 | requestData: function(){ |
83 | - | |
84 | 83 | }, |
85 | 84 | |
86 | 85 | /** |
... | ... | @@ -110,6 +109,15 @@ var WorkcycleBehavior = { |
110 | 109 | }, |
111 | 110 | |
112 | 111 | /** |
112 | + * Build the object/s for presentation layer. | |
113 | + * | |
114 | + * @method presentData | |
115 | + */ | |
116 | + presentData: function(){ | |
117 | + | |
118 | + }, | |
119 | + | |
120 | + /** | |
113 | 121 | * Called when iron-ajax component receive the json data from called url. It is responsible to |
114 | 122 | * extract data from response, coded in json, and refine it by using JsonPath queries in the query attribute. |
115 | 123 | * After this phase it parses the resulting object to populate the structure(keys,values) to fill the final table by using |
... | ... | @@ -121,6 +129,7 @@ var WorkcycleBehavior = { |
121 | 129 | this.selectData(); |
122 | 130 | this.filterData(); |
123 | 131 | this.transformData(); |
132 | + this.presentData(); | |
124 | 133 | }, |
125 | 134 | |
126 | 135 | init: function(component){ | ... | ... |
datalets/column3Dchart-datalet/column3Dchart-datalet.html
datalets/columnchart-datalet/columnchart-datalet.html
datalets/datatable-datalet/datatable-datalet.html
datalets/highcharts-datalet/highcharts-datalet.html
datalets/leafletjs-datalet/leafletjs-datalet.html
datalets/linechart-datalet/linechart-datalet.html
datalets/treemap-datalet/treemap-datalet.html
... | ... | @@ -88,11 +88,13 @@ THE SOFTWARE. |
88 | 88 | <script> |
89 | 89 | |
90 | 90 | var TreemapBehavior = { |
91 | + | |
91 | 92 | map : { |
92 | 93 | name : "Expenses", |
93 | 94 | children : [] |
94 | 95 | }, |
95 | - selectData: function(e) | |
96 | + | |
97 | + transformData: function(e) | |
96 | 98 | { |
97 | 99 | var treemapData = []; |
98 | 100 | |
... | ... | @@ -117,8 +119,11 @@ THE SOFTWARE. |
117 | 119 | for(var i = 0; i < treemapData.length; i++){ |
118 | 120 | this.checkAggragationField(treemapData[i], this._component.fields.length , this._component.fields.length - 1); |
119 | 121 | } |
122 | + | |
120 | 123 | var json = JSON.stringify(this.map); |
124 | + | |
121 | 125 | }, |
126 | + | |
122 | 127 | findChild: function(child, category){ |
123 | 128 | var children = child.children; |
124 | 129 | for (var i=0; i<children.length; i++) { |
... | ... | @@ -129,6 +134,7 @@ THE SOFTWARE. |
129 | 134 | children.push(nchild); |
130 | 135 | return nchild; |
131 | 136 | }, |
137 | + | |
132 | 138 | checkAggragationField: function(object, levels, value_index){ |
133 | 139 | var curchild = this.map; |
134 | 140 | var keys = Object.keys(object); |
... | ... | @@ -145,7 +151,8 @@ THE SOFTWARE. |
145 | 151 | curchild.children = null; |
146 | 152 | curchild.value = value; |
147 | 153 | }, |
148 | - transformData: function(){ | |
154 | + | |
155 | + presentData: function(){ | |
149 | 156 | build(this.map, "treemap_placeholder"); |
150 | 157 | } |
151 | 158 | }; | ... | ... |