opower/elroi — pull request #16 by gsmith85 (2013-04-05 06:11:16+00:00)
Title: Fix, improve, and refactor distortMaxValuesBy

- The calculation used to determine how much to scale graph values to
additionally fit flags, labeling, etc. was incorrect and is now
fixed. Previously if the total graph area was 100 and labeling took
up 20 pixels a scale factor of 1.2 was returned. The desired effect
in this case is to have the bars take up 80 pixels, so the scale
factor should have been 1.25.
- When determining the amount of pixels needed for labeling, the text
from the longest label is used. When injected to discern the height
from the DOM element, it is injected as HTML so character codes are
reduced to a single character.
- Refactored distortMaxValues to improve readablity and to make it
more consistent with the rest of the code in Elroi.