Skip to content

Commit

Permalink
Merge pull request #56 from Caleydo/lineupjs4
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkh authored Jun 15, 2020
2 parents 6f7dcbd + 2477da7 commit 5fa53d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/RankingAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {LocalDataProvider, IColumnDesc, ICategory, Column, Ranking, IDataRow, isMissingValue, CategoricalColumn} from 'lineupjs';
import {LocalDataProvider, IColumnDesc, ICategory, Column, Ranking, IDataRow, IOrderedGroup} from 'lineupjs';
import {IServerColumn} from 'tdp_core/src/rest';
import {isScoreColumn} from './utils';
import {IAccessorFunc} from 'tdp_core/src/lineup/internal/utils';
Expand Down Expand Up @@ -140,10 +140,9 @@ export class RankingAdapter {
/**
* Returns an array of indices for the providers data array
*/
private getItemOrder() {
private getItemOrder(): number[] {
// order is always defined for groups (rows (data) only if there is a grouping)
return [].concat(...this.getRanking().getGroups().map((grp) => grp.order)); // Map groups to order arrays and concat those

return [].concat(...this.getRanking().getGroups().map((grp) => Array.from(grp.order))); // Map groups to order arrays and concat those
}

public getDisplayedIds() {
Expand Down Expand Up @@ -190,20 +189,16 @@ export class RankingAdapter {
// console.time('get data (getGroupedData) time')
const data = this.getItems();
// console.timeEnd('get data (getGroupedData) time')
const groups = [];

for (const grp of this.getRanking().getGroups()) {
groups.push({
return this.getRanking().getGroups().map((grp: IOrderedGroup) => {
return {
name: grp.name,
label: grp.name,
color: grp.color,
rows: grp.order.map((index) => data[index]).filter((item) => item !== undefined)
});
}
return groups;
rows: Array.from(grp.order).map((index) => data[index]).filter((item) => item !== undefined)
};
});
}


/**
* returns the data for the given attribute
* @param attributeId column property of the column description
Expand Down
1 change: 1 addition & 0 deletions src/tasks/ATouringTask.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as $ from 'jquery';
import * as d3 from 'd3';
import 'select2';
import {IMeasureResult, ISimilarityMeasure, ISetParameters, SCOPE, IMeasureVisualization} from '../interfaces';
import {RankingAdapter} from '../RankingAdapter';
import {WorkerManager} from '../Workers/WorkerManager';
Expand Down

0 comments on commit 5fa53d7

Please sign in to comment.