Commit ba34d411e9bef189508f5a24a535bb7cf4cfffc2
Merge branch 'master' of http://service.routetopa.eu:7480/WebCompDev/COMPONENTS
Showing
1 changed file
with
30 additions
and
29 deletions
datalets/highcharts-datalet/highcharts-datalet.html
@@ -88,24 +88,26 @@ Example : | @@ -88,24 +88,26 @@ Example : | ||
88 | /** | 88 | /** |
89 | * Normalizes a number in agreement with javascript's conventions. Delete all NaN characters. Exception: number representing lat & long remain unchanged. | 89 | * Normalizes a number in agreement with javascript's conventions. Delete all NaN characters. Exception: number representing lat & long remain unchanged. |
90 | */ | 90 | */ |
91 | -// jNumConverter: function(num) { | ||
92 | -// //lat-long | ||
93 | -// if(num.charAt(num.length-7) == "." && (num.match(/[\.,]/g) || []).length == 1) | ||
94 | -// return num; | ||
95 | -// | ||
96 | -// var jNum = ""; | ||
97 | -// for (var i = 0; i < num.length; i++) { | ||
98 | -// if(num[i].match(/[\.,]/g)) | ||
99 | -// if (i == num.length - 3) | ||
100 | -// jNum += "."; | ||
101 | -// else | ||
102 | -// ; | ||
103 | -// else if (!isNaN(num[i])) | ||
104 | -// jNum += num[i]; | ||
105 | -// } | ||
106 | -// | ||
107 | -// return jNum; | ||
108 | -// }, | 91 | + jNumConverter: function(num) { |
92 | + //lat-long | ||
93 | + if(num.charAt(num.length-7) == "." && (num.match(/[\.,]/g) || []).length == 1) | ||
94 | + return num; | ||
95 | + | ||
96 | + num = num.replace(/[^0-9\.]/, ''); | ||
97 | + | ||
98 | + var jNum = ""; | ||
99 | + for (var i = 0; i < num.length; i++) { | ||
100 | + if(num[i].match(/[\.,]/g)) | ||
101 | + if (i == num.length - 3) | ||
102 | + jNum += "."; | ||
103 | + else | ||
104 | + ; | ||
105 | + else if (!isNaN(num[i])) | ||
106 | + jNum += num[i]; | ||
107 | + } | ||
108 | + | ||
109 | + return jNum; | ||
110 | + }, | ||
109 | /** | 111 | /** |
110 | * Populate the categories and the series array. | 112 | * Populate the categories and the series array. |
111 | * | 113 | * |
@@ -121,17 +123,16 @@ Example : | @@ -121,17 +123,16 @@ Example : | ||
121 | 123 | ||
122 | for (var i = 1; i < this.data.length; i++) | 124 | for (var i = 1; i < this.data.length; i++) |
123 | { | 125 | { |
124 | - | ||
125 | -// this.data[i].data.every(function (element, index, array) { | ||
126 | -// try { | ||
127 | -// var e = HighchartsBehavior.jNumConverter(element); | ||
128 | -// (isNaN(element)) ? array[index] = parseFloat(HighchartsBehavior.jNumConverter(element)) : | ||
129 | -// array[index] = parseFloat(element); | ||
130 | -// }catch(e){ | ||
131 | -// //console.log("Parsing data error. Highchart-datalet.selectData"); | ||
132 | -// } | ||
133 | -// return true; | ||
134 | -// }); | 126 | + this.data[i].data.every(function (element, index, array) { |
127 | + try { | ||
128 | + var e = HighchartsBehavior.jNumConverter(element); | ||
129 | + (isNaN(element)) ? array[index] = parseFloat(HighchartsBehavior.jNumConverter(element)) : | ||
130 | + array[index] = parseFloat(element); | ||
131 | + }catch(e){ | ||
132 | + //console.log("Parsing data error. Highchart-datalet.selectData"); | ||
133 | + } | ||
134 | + return true; | ||
135 | + }); | ||
135 | 136 | ||
136 | this.properties.series.value.push(this.data[i]); | 137 | this.properties.series.value.push(this.data[i]); |
137 | } | 138 | } |