Skip to main content
Version: Next

sniffCoordinateDescriptor

Callable

  • sniffCoordinateDescriptor(values: readonly (string | number | null | undefined)[] | undefined, sampleSize?: number): CoordinateDescriptor | undefined

  • Derives a descriptor from the data itself, for columns that declare no units. Only the values are consulted; the column name is deliberately not an input here, because a name states intent and intent is the ranking layer's business, not the parser's.

    A format is a property of the column, not of every row in it, so a minority of unreadable values does not overturn what the rest plainly are: catalogs write a missing coordinate as a placeholder ("--", "N/A"), and parseCoordinateValue already drops such a row as NaN once the format is settled. Letting one of them veto the column instead removed it from the axis menu altogether, where the user had no way to say otherwise. Recognized values must still be a strict majority, and must still all agree -- two formats in one column is a genuine ambiguity that guessing cannot resolve.

    Returns undefined when the recognized values disagree or fail to carry the majority, and when there was nothing to inspect. The caller separates that last case from the others with hasCoordinateValuesToInspect: only values that were read and rejected are evidence that a column is not a coordinate.


    Parameters

    • values: readonly (string | number | null | undefined)[] | undefined
    • sampleSize: number = COORDINATE_SNIFF_SAMPLE_SIZE

    Returns CoordinateDescriptor | undefined