Line data Source code
1 1 : export function formatHistogramFocusDescription(
2 1 : count: bigint,
3 1 : rowCount: number,
4 1 : filteredCount: bigint | null = null,
5 1 : filteredRowCount: number | null = null,
6 1 : ): string {
7 1 : const displayedCount = filteredCount ?? count;
8 1 : const displayedRowCount = filteredRowCount ?? rowCount;
9 1 : const percentage = displayedRowCount === 0
10 1 : ? 0
11 1 : : Math.round((Number(displayedCount) / displayedRowCount) * 100 * 100) / 100;
12 1 : return `${displayedCount} ${displayedCount === 1n ? "row" : "rows"} (${percentage}%)`;
13 1 : }
|