function createUnitToggle(id, product) {
        var units = product.units, size = units.length;
        var index = +(d3.select(id).attr("data-index") || 0) % size;
        return {
            value: function() {
                return units[index];
            },
            next: function() {
                d3.select(id).attr("data-index", index = ((index + 1) % size));
            }
        };
    }
Constructs a toggler for the specified product's units, storing the toggle state on the element having
the specified id. For example, given a product having units ["m/s", "mph"], the object returned by this
method sets the element's "data-index" attribute to 0 for m/s and 1 for mph. Calling value() returns the
currently active units object. Calling next() increments the index.