MAIDR Documentation - v4.4.0
    Preparing search index...
    • Rounds a value to the precision the drawn geometry can actually carry.

      A line's vertices are read back out of its d attribute, and the path serializer writes each coordinate to a fixed number of decimal places — so unlike a rect's x and y, the number is quantised before the adapter ever sees it. On a chart spanning thousands of units that quantisation is worth more than a unit of data, and reporting the inverted figure in full would dress a rounded pixel up as an exact measurement.

      So the value is rounded to the granularity the pixel quantum buys, and no finer. On an ordinary chart the quantum is worth far less than the last decimal of the data, and the value comes back exact.

      Parameters

      • value: number

        The inverted value.

      • scale: PlotScale | undefined

        The scale it was inverted through.

      • pixelError: number

        Half the pixel quantum the coordinate was written at.

      Returns number

      The value, rounded to the precision the geometry supports.