Variable Width Bars - This is done using some simple calculus - an excerpt from the source:
The width of a bar is given by area under the graph:
Uniform Non-Uniform
| |--
1 |------ 1 | --
| | --
+------ +------
0 x 1 0 x 1
Where x (0 to 1) represents the width of the entire Canvas and y
represents the scaling factor that adjusts the individual bar widths.
To determine a bar width, take the area of the trapezoid:
|\
| \
| \
| |
| |
+---+
a b
Where a represents the current bar position and b represents the next
bar position (if the bars were to be evenly spaced).
NOTE: The function for uniform is simply a constant value (a line
parallel to y=0). For non-uniform, that line is rotated around
(0.5, 1.0), maintaining constant area from x=0 to x=1 as required.