feat(sort): custom series sort in study panel (#4214)

This commit is contained in:
Ibrahim authored and GitHub committed 2024-06-20 16:58:59 -04:00
1 parent 6f93449149
commit a433d406e2
17 files changed
+211 -15

No files matched your search

@@ -424,4 +424,24 @@ export default class DisplaySetService extends PubSubService {
return result;
}
/**
*
* @param sortFn function to sort the display sets
* @param direction direction to sort the display sets
* @returns void
*/
public sortDisplaySets(
sortFn: (a: DisplaySet, b: DisplaySet) => number,
direction: string,
suppressEvent = false
): void {
this.activeDisplaySets.sort(sortFn);
if (direction === 'descending') {
this.activeDisplaySets.reverse();
}
if (!suppressEvent) {
this._broadcastEvent(EVENTS.DISPLAY_SETS_CHANGED, this.activeDisplaySets);
}
}
}