novus/nvd3 — pull request #585 by luke3141 (2014-06-12 17:52:24+00:00)
Title: Fixes x axis label position (v2.0.0-dev)

This is a rebased version of #447.

Formerly, when there was (eg) a bar chart with just 1 or 2 bars then the position was wrong. The reason for this is that scale.range[0] was the position of the first bar, and scale.range[1] the position of the 2nd. The label was being placed at scale.range[1]/2 which was about 1/4 to 1/3 through the graph.

The new version works as follows:
* If there is `scale.rangeExtent` (ie: the scale is ordinal [not continuous], eg: bar chart) then rangeExtent contains the upper and lower values of the range. we use this to calculate the mid point.
* If not, then if there are more than 2 points, we use the same method as previous - take the highest point, add one more interval (distance between consecutive scale points), and find the half way point between here and the start
* if there are only two points and the first one is zero, go half way between them.
* if there are only two points and the first one is not zero, then use the same method as if there are multiple points.
* if there is only one point, then use that.