OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // TODO: | 5 // TODO: |
6 // 1. Visibility functions: base on boxPadding.t, not 15 | 6 // 1. Visibility functions: base on boxPadding.t, not 15 |
7 // 2. Track a maxDisplayDepth that is user-settable: | 7 // 2. Track a maxDisplayDepth that is user-settable: |
8 // maxDepth == currentRoot.depth + maxDisplayDepth | 8 // maxDepth == currentRoot.depth + maxDisplayDepth |
9 function D3SymbolTreeMap(mapWidth, mapHeight, levelsToShow) { | 9 function D3SymbolTreeMap(mapWidth, mapHeight, levelsToShow) { |
10 this._mapContainer = undefined; | 10 this._mapContainer = undefined; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 */ | 185 */ |
186 D3SymbolTreeMap.prototype._crunchStats = function(node) { | 186 D3SymbolTreeMap.prototype._crunchStats = function(node) { |
187 var stack = []; | 187 var stack = []; |
188 stack.idCounter = 0; | 188 stack.idCounter = 0; |
189 this._crunchStatsHelper(stack, node); | 189 this._crunchStatsHelper(stack, node); |
190 } | 190 } |
191 | 191 |
192 /** | 192 /** |
193 * Invoke the specified visitor function on all data elements currently shown | 193 * Invoke the specified visitor function on all data elements currently shown |
194 * in the treemap including any and all of their children, starting at the | 194 * in the treemap including any and all of their children, starting at the |
195 * currently-displayed root and descening recursively. The function will be | 195 * currently-displayed root and descending recursively. The function will be |
196 * passed the datum element representing each node. No traversal guarantees | 196 * passed the datum element representing each node. No traversal guarantees |
197 * are made. | 197 * are made. |
198 */ | 198 */ |
199 D3SymbolTreeMap.prototype.visitFromDisplayedRoot = function(visitor) { | 199 D3SymbolTreeMap.prototype.visitFromDisplayedRoot = function(visitor) { |
200 this._visit(this._currentRoot, visitor); | 200 this._visit(this._currentRoot, visitor); |
201 } | 201 } |
202 | 202 |
203 /** | 203 /** |
204 * Helper function for visit functions. | 204 * Helper function for visit functions. |
205 */ | 205 */ |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 if (datum.value > smallest) { // array is already full | 929 if (datum.value > smallest) { // array is already full |
930 result.push(datum); | 930 result.push(datum); |
931 result.sort(sortFunction); | 931 result.sort(sortFunction); |
932 result.pop(); // get rid of smallest element | 932 result.pop(); // get rid of smallest element |
933 smallest = result[maxRecords - 1].value; // new threshold for entry | 933 smallest = result[maxRecords - 1].value; // new threshold for entry |
934 } | 934 } |
935 }); | 935 }); |
936 result.sort(sortFunction); | 936 result.sort(sortFunction); |
937 return result; | 937 return result; |
938 } | 938 } |
OLD | NEW |