Skip to content

Commit

Permalink
Calc
Browse files Browse the repository at this point in the history
  • Loading branch information
isublimity committed Jan 29, 2018
1 parent 24aeefa commit ee1116a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
7 changes: 6 additions & 1 deletion manual/docs/tips_ru.md → manual/docs/Tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,9 @@ $var_name

Экспериментальная разработка - поддержка Plotly для построения 3D

![Tabix 3D ](https://tabix.io/doc/img/plotly_mesh3d.png)
![Tabix 3D ](https://tabix.io/doc/img/plotly_mesh3d.png)


## Calc sum

Select cells -> Right click -> "Calc Avg & Sum & Median"
29 changes: 29 additions & 0 deletions src/app/draw/handtable.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,35 @@ class HandsTable {

}

static Calc(ht,command) {

let s = HandsTable.getSelected(ht,true);

let outText = [];
let columns = ht.getSettings().columns;
let rr = [];
for (let col = s.fromCol; col <= s.toCol; col++) {

for (let row = s.fromRow; row <= s.toRow; row++) {
let typeColumn = columns[col].type.toLowerCase();
if (typeColumn.includes('numeric')) {
rr.push(ht.getDataAtCell(row, col));
}
}
}
if (_.isArray(rr) && rr.length)
{
let val={
median:_.round(_.median(rr),3),
sum:_.round(_.sum(rr),3),
average:_.round(_.average(rr),3),
std:_.round(_.stdDeviation(rr),3)
};
angular.element(document).scope().$emit('handleBroadcastCalcSumCells', val);

}
}

static Transpose(ht,command) {
let d=HandsTable.transpose(ht.getSourceData());
let colHeaders=[];
Expand Down

0 comments on commit ee1116a

Please sign in to comment.