Skip to content

Commit

Permalink
closes #161 sort groups similar to sort values
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Mar 25, 2020
1 parent 6f83c31 commit 6da170f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/model/internalCategorical.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ export function toMostFrequentCategoricals(rows: ISequence<IDataRow>, col: ICate
/** @internal */
export function toGroupCompareCategoryValue(rows: ISequence<IDataRow>, col: ICategoricalColumn, valueCache?: ISequence<ICategory | null>): ICompareValue[] {
if (isSeqEmpty(rows)) {
return [NaN, 0];
return [NaN, null]
}
const mostFrequent = findMostFrequent(rows.map((d) => col.getCategory(d)), valueCache);
if (mostFrequent.cat == null) {
return [NaN, 0];
return [NaN, null];
}
return [mostFrequent.cat.value, mostFrequent.count];
return [mostFrequent.cat.value, mostFrequent.cat.name.toLowerCase()];
}

export const COMPARE_GROUP_CATEGORY_VALUE_TYPES = [ECompareValueType.FLOAT, ECompareValueType.COUNT];
export const COMPARE_GROUP_CATEGORY_VALUE_TYPES = [ECompareValueType.FLOAT, ECompareValueType.STRING];

/** @internal */
function compareCategory(a: ICategory | null, b: ICategory | null) {
Expand Down

0 comments on commit 6da170f

Please sign in to comment.