Skip to content

Commit

Permalink
percentage of columns fix
Browse files Browse the repository at this point in the history
  • Loading branch information
arajajyothibabu committed Sep 25, 2017
1 parent 594b1a9 commit 5efdc37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cohort-graph",
"version": "0.8.0",
"version": "0.8.5",
"description": "Cohort Analysis Graph",
"main": "lib/cohortgraph.js",
"scripts": {
Expand Down
9 changes: 7 additions & 2 deletions src/DataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,19 @@ export default class DataStore {
*
* @param arr
* @param index
* @param baseIndex
* @returns {number}
* @private
*/
_sumOfFirstColumnUpToIndex = (arr, index) => {
_sumOfFirstColumnUpToIndex = (arr, index, baseIndex) => {
let sum = 0;
for(let i = 0; i <= index; i++){
try {
sum += arr[i][1].value;
if(arr[i][baseIndex]){ //If value exists upto this index FIXME: need better understanding than this
sum += arr[i][1].value;
}else{
break;
}
}catch(e){
break;
}
Expand Down

0 comments on commit 5efdc37

Please sign in to comment.