1. 30 Jun, 2013 1 commit
    • Mike Bostock's avatar
      Accept function for selection append and insert. · bef1ccb9
      Mike Bostock authored
      Like selection.select, selection.append and selection.insert can now accept a
      function which returns a node. This makes it slightly easier to append or insert
      elements whose name is computed from data, or to append elements that already
      exist (say from an element pool).
      
      There has been much discussion regarding whether the function should return the
      name of the element or the element itself. Returning a name is less work for the
      caller, but only supports creating new elements; returning a name is also more
      consistent with how D3 defines attribute values, but D3 does not allow attribute
      names to be specified as functions. So, it seemed better to opt for consistency
      with selection.select and selection.selectAll, which accept functions that
      return elements, since this is more expressive. Of course, you can still use
      select and selectAll to append elements, but using append to do that directly is
      more intuitive.
      
      Related #4 #311 #724 #732 #734 #961 #1031 #1271.
      bef1ccb9
  2. 29 Jun, 2013 6 commits
  3. 27 Jun, 2013 3 commits
  4. 26 Jun, 2013 2 commits
  5. 25 Jun, 2013 8 commits
  6. 24 Jun, 2013 3 commits
  7. 21 Jun, 2013 3 commits
  8. 20 Jun, 2013 1 commit
  9. 19 Jun, 2013 6 commits
  10. 18 Jun, 2013 4 commits
    • Mike Bostock's avatar
      Restore undefined behavior for d3.bisect. · 301b6d3b
      Mike Bostock authored
      Rather than return NaN, this change restores the previous undefined behavior
      when an unorderable value is used for bisection. After discussing with Jason, I
      think this is more consistent given that d3.bisect also requires that the input
      array is sortable, and therefore only contains orderable values. Thus, it is the
      responsibility of the caller to check that the search value is defined before
      doing bisection, and so this commit fixes the threshold scale rather than the
      bisect method. (Also, this is consistent with the existing quantile scale.)
      301b6d3b
    • Mike Bostock's avatar
      Return undefined, not NaN. · 0edad183
      Mike Bostock authored
      Since the quantile scale allows arbitrary values in the range, there’s no reason
      the return value for unorderable input needs to be a number.
      0edad183
    • Mike Bostock's avatar
      Slightly shorter. · 538108b0
      Mike Bostock authored
      538108b0
    • Mike Bostock's avatar
      Fixes for non-orderable values. · aad1b188
      Mike Bostock authored
      In addition to NaN, which is not equal to itself, you can have objects that are
      not orderable due to defined valueOf functions which return NaN. For example:
      
        var o = new Number(NaN);
      
      Here, o == o is true, but o <= o is false. Therefore it was possible for d3.min,
      d3.max and d3.extent to observe these non-orderable values rather than ignore
      them as intended. The fix is to check !(o <= o) rather than o == o.
      
      This commit also fixes d3.bisect when the search value is non-orderable.
      Previously, bisectLeft returned lo for non-orderable values, and bisectRight
      returned hi. However, if the search value is non-orderable, then this return
      value does not satisfy the conditions of bisection. This commit changes the
      bisection methods to return NaN when the search value is non-orderable.
      
      As a side-effect, the fix to d3.bisect now causes d3.scale.threshold to return
      undefined when passed a non-orderable value, such as undefined. (Previously, a
      threshold scale would return the highest value in the range, because it used
      bisectRight internally.)
      aad1b188
  11. 14 Jun, 2013 2 commits
  12. 13 Jun, 2013 1 commit