function parseRankColumns()

in packages/tablesorter-powerbi/src/ConfigBuilder.ts [114:140]


function parseRankColumns(dataView: powerbi.DataView, colorSettings: IColorSettings, reverseRankingColumns = false) {
    "use strict";
    const ci = calculateRankingInfo(dataView);
    if (ci) {
        const colors = calculateRankColors(ci.values, colorSettings);
        if (reverseRankingColumns) {
            ci.values.reverse();
        }
        const toCompare = d3.extent(ci.values)[LOWER_NUMBER_HIGHER_VALUE ? 0 : 1];
        return {
            columns: ci.values.map((n, i) => {
                return {
                    label: `${ n !== toCompare ? "≥" : ""} ${n}`,
                    column: `${GENERATED_COLUMN_NAME_PREFIX}${n}`,
                    bucket: n,
                    type: "string",
                    width: 60,
                    color: colors[n],
                    filterable: false,
                    sortable: false,
                    isConfidence: true,
                };
            }),
            info: ci,
        };
    }
}