Commit 5c59a590 authored by GoshaZotov's avatar GoshaZotov Committed by Alexander.Trofimov

add percent top10 filter

parent 22c543df
...@@ -6166,6 +6166,7 @@ Top10.prototype.init = function(range, reWrite){ ...@@ -6166,6 +6166,7 @@ Top10.prototype.init = function(range, reWrite){
{ {
var arr = []; var arr = [];
var alreadyAddValues = {}; var alreadyAddValues = {};
var count = 0;
range._foreach2(function(cell){ range._foreach2(function(cell){
var val = parseFloat(cell.getValue()); var val = parseFloat(cell.getValue());
...@@ -6173,6 +6174,7 @@ Top10.prototype.init = function(range, reWrite){ ...@@ -6173,6 +6174,7 @@ Top10.prototype.init = function(range, reWrite){
{ {
arr.push(val); arr.push(val);
alreadyAddValues[val] = 1; alreadyAddValues[val] = 1;
count++;
} }
}); });
...@@ -6192,7 +6194,16 @@ Top10.prototype.init = function(range, reWrite){ ...@@ -6192,7 +6194,16 @@ Top10.prototype.init = function(range, reWrite){
return res; return res;
}); });
res = arr[this.Val - 1]; if(this.Percent)
{
var num = parseInt(count * (this.Val / 100));
res = arr[num - 1];
}
else
{
res = arr[this.Val - 1];
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment