Commit 5bc002a2689f6f7fd9e937cad0dd94e4565c8860

Authored by isisadmin
1 parent 8afea66c

datalet refactoring

datalets/barchart-datalet/barchart-datalet.html
... ... @@ -49,7 +49,7 @@ Example:
49 49 *
50 50 * @method transformData
51 51 */
52   - transformData: function(){
  52 + presentData: function(){
53 53  
54 54 $(this._component.$.charts.$.container).highcharts({
55 55 chart: {
... ...
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
... ... @@ -61,7 +61,7 @@ Example:
61 61 *
62 62 * @method transformData
63 63 */
64   - transformData: function(){
  64 + presentData: function(){
65 65 chart = new Highcharts.Chart({
66 66 chart: {
67 67 renderTo: this._component.$.charts.$.container,
... ...
datalets/columnchart-datalet/columnchart-datalet.html
... ... @@ -49,7 +49,7 @@ Example:
49 49 *
50 50 * @method transformData
51 51 */
52   - transformData: function(){
  52 + presentData: function(){
53 53 $(this._component.$.charts.$.container).highcharts({
54 54 chart: {
55 55 type: 'column',
... ...
datalets/datatable-datalet/datatable-datalet.html
... ... @@ -32,7 +32,7 @@ Example
32 32 <script>
33 33 var DatatableBehavior = {
34 34  
35   - transformData: function(){
  35 + presentData: function(){
36 36 if(!this.data || this.data == undefined) return;
37 37 html = "";
38 38 html += '<thead>'+
... ...
datalets/highcharts-datalet/highcharts-datalet.html
... ... @@ -31,7 +31,7 @@
31 31 }
32 32 },
33 33  
34   - selectData: function () {
  34 + transformData: function () {
35 35  
36 36 this.properties.categories.value = this.data[0].data;
37 37  
... ...
datalets/leafletjs-datalet/leafletjs-datalet.html
... ... @@ -60,7 +60,7 @@ Example:
60 60 *
61 61 * @method transformData
62 62 */
63   - transformData: function(){
  63 + presentData: function(){
64 64  
65 65 var coordinates = [];
66 66 //var keys = Object.keys(this.properties.data.value[0]);
... ...
datalets/linechart-datalet/linechart-datalet.html
... ... @@ -49,7 +49,7 @@ Example:
49 49 *
50 50 * @method transformData
51 51 */
52   - transformData: function(){
  52 + presentData: function(){
53 53  
54 54 $(this._component.$.charts.$.container).highcharts({
55 55 title: {
... ...
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 };
... ...