MAIDR Documentation - v4.4.0
    Preparing search index...

    Function toBarValue

    • Reads one bar's magnitude, keeping a gap distinguishable from a zero.

      A chart library reports a missing bar as null — plotly renders a zero-height rect and keeps the point, so the gap arrives here rather than being dropped. Number(null) is 0, which makes an absent bar indistinguishable from one genuinely measured at zero: it sounds like a real low point, it can be reached as the row's minimum, and it pulls the range that every other bar's pitch is scaled against. NaN keeps it absent, which is what the text layer already announces it as.

      A blank cell counts as a gap for the same reason: Number('') and Number(' ') are also 0, so a hand-authored figure with an empty cell would land in the same trap.

      Parameters

      • raw: string | number | null | undefined

        The value from the point, on whichever axis carries magnitude

      Returns number

      The magnitude, or NaN when the bar is a gap