# Left and Right Justified Contiguous Bar Charts

Version 4

Description:

With the addition of the ability to specify the width of bars on a bar chart using a measure field it is possible to create contiguously filled bar charts. This can be accomplished with either left justification or right justification, using either a look ahead or look back table calculation.

$\begin{array}{rcl}&space;{left}_{point}&space;&&space;=&space;&&space;{position}_{point&space;+&space;1}&space;-&space;{position}_{point}\\&space;{right}_{point}&space;&&space;=&space;&&space;{position}_{point}&space;-&space;{position}_{point&space;-&space;1}&space;\end{array}$

At the edges we have to set the left justified width to zero for the last point, and conversely the right justified width to zero at the first point.

Example Calculation:

// The left justified width sets the last width to zero,

// and looks ahead to the next position.

[LEFT] := IFNULL(LOOKUP(ATTR([ORDER]), 1), ATTR([ORDER])) - ATTR([ORDER])

// The right justified width sets the first width to zero,

// and looks back to the previous position.

[RIGHT] := ATTR([ORDER]) - IFNULL(LOOKUP(ATTR([ORDER]), -1), ATTR([ORDER]))

Inputs and Setup:

The table calculations of the left and right widths require an continuous dimension as input, in this example the field is called [ORDER].

The table calculations of left and right widths must address the same field that determines the position, in this example the field is called [ORDER].

The choice of whether to create contiguously filled bar charts with left or right justification is irrelevant in the asymptotic limit of large sample sizes, provided the actual sampling distribution has support across the whole domain.

Related Functions:

IFNULL, LOOKUP, ATTR, SIZE, INDEX