@@ 86-108 (lines=23) @@ | ||
83 | } |
|
84 | return a; |
|
85 | }; |
|
86 | d3.extent = function(array, f) { |
|
87 | var i = -1, n = array.length, a, b, c; |
|
88 | if (arguments.length === 1) { |
|
89 | while (++i < n) if ((b = array[i]) != null && b >= b) { |
|
90 | a = c = b; |
|
91 | break; |
|
92 | } |
|
93 | while (++i < n) if ((b = array[i]) != null) { |
|
94 | if (a > b) a = b; |
|
95 | if (c < b) c = b; |
|
96 | } |
|
97 | } else { |
|
98 | while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { |
|
99 | a = c = b; |
|
100 | break; |
|
101 | } |
|
102 | while (++i < n) if ((b = f.call(array, array[i], i)) != null) { |
|
103 | if (a > b) a = b; |
|
104 | if (c < b) c = b; |
|
105 | } |
|
106 | } |
|
107 | return [ a, c ]; |
|
108 | }; |
|
109 | function d3_number(x) { |
|
110 | return x === null ? NaN : +x; |
|
111 | } |
|
@@ 69-85 (lines=17) @@ | ||
66 | } |
|
67 | return a; |
|
68 | }; |
|
69 | d3.max = function(array, f) { |
|
70 | var i = -1, n = array.length, a, b; |
|
71 | if (arguments.length === 1) { |
|
72 | while (++i < n) if ((b = array[i]) != null && b >= b) { |
|
73 | a = b; |
|
74 | break; |
|
75 | } |
|
76 | while (++i < n) if ((b = array[i]) != null && b > a) a = b; |
|
77 | } else { |
|
78 | while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { |
|
79 | a = b; |
|
80 | break; |
|
81 | } |
|
82 | while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b; |
|
83 | } |
|
84 | return a; |
|
85 | }; |
|
86 | d3.extent = function(array, f) { |
|
87 | var i = -1, n = array.length, a, b, c; |
|
88 | if (arguments.length === 1) { |
|
@@ 52-68 (lines=17) @@ | ||
49 | d3.descending = function(a, b) { |
|
50 | return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; |
|
51 | }; |
|
52 | d3.min = function(array, f) { |
|
53 | var i = -1, n = array.length, a, b; |
|
54 | if (arguments.length === 1) { |
|
55 | while (++i < n) if ((b = array[i]) != null && b >= b) { |
|
56 | a = b; |
|
57 | break; |
|
58 | } |
|
59 | while (++i < n) if ((b = array[i]) != null && a > b) a = b; |
|
60 | } else { |
|
61 | while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { |
|
62 | a = b; |
|
63 | break; |
|
64 | } |
|
65 | while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b; |
|
66 | } |
|
67 | return a; |
|
68 | }; |
|
69 | d3.max = function(array, f) { |
|
70 | var i = -1, n = array.length, a, b; |
|
71 | if (arguments.length === 1) { |