meo-canvas
    Preparing search index...

    Function barLayout

    • Where every bar of a cartesian chart sits, as fractions of the plot area.

      This is the reference. In fractions the arithmetic holds whatever size the plot turns out to be, which is what lets layout resolve it:

      groupWidth = 1 / labels
      spacing    = groupWidth * 0.2
      barWidth   = (groupWidth - spacing) / series
      x          = index * groupWidth + spacing/2 + series * barWidth
      height     = value / maxValue
      

      y is not returned: a bar is anchored to the bottom of the plot, and a bottom-aligned box says that without arithmetic.

      Parameters

      • labels: number
      • series: number
      • values: readonly (readonly number[])[]
      • maxValue: number

      Returns { height: number; width: number; x: number }[][]

      • height: number

        Bar height, as a fraction of the plot's height.

        Zero when every value is zero, rather than the NaN the division would give.

      • width: number

        Bar width, as a fraction of the plot's width.

      • x: number

        Left edge, as a fraction of the plot's width.