| 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 16 matching lines...) Expand all Loading... |
| 27 this._currentNodes = undefined; | 27 this._currentNodes = undefined; |
| 28 this._treeData = undefined; | 28 this._treeData = undefined; |
| 29 this._maxLevelsToShow = levelsToShow; | 29 this._maxLevelsToShow = levelsToShow; |
| 30 this._currentMaxDepth = this._maxLevelsToShow; | 30 this._currentMaxDepth = this._maxLevelsToShow; |
| 31 } | 31 } |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * Make a number pretty, with comma separators. | 34 * Make a number pretty, with comma separators. |
| 35 */ | 35 */ |
| 36 D3SymbolTreeMap._pretty = function(num) { | 36 D3SymbolTreeMap._pretty = function(num) { |
| 37 num = Math.round(num) |
| 37 var asString = String(num); | 38 var asString = String(num); |
| 38 var result = ''; | 39 var result = ''; |
| 39 var counter = 0; | 40 var counter = 0; |
| 40 for (var x = asString.length - 1; x >= 0; x--) { | 41 for (var x = asString.length - 1; x >= 0; x--) { |
| 41 counter++; | 42 counter++; |
| 42 if (counter === 4) { | 43 if (counter === 4) { |
| 43 result = ',' + result; | 44 result = ',' + result; |
| 44 counter = 1; | 45 counter = 1; |
| 45 } | 46 } |
| 46 result = asString.charAt(x) + result; | 47 result = asString.charAt(x) + result; |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 if (datum.value > smallest) { // array is already full | 903 if (datum.value > smallest) { // array is already full |
| 903 result.push(datum); | 904 result.push(datum); |
| 904 result.sort(sortFunction); | 905 result.sort(sortFunction); |
| 905 result.pop(); // get rid of smallest element | 906 result.pop(); // get rid of smallest element |
| 906 smallest = result[maxRecords - 1].value; // new threshold for entry | 907 smallest = result[maxRecords - 1].value; // new threshold for entry |
| 907 } | 908 } |
| 908 }); | 909 }); |
| 909 result.sort(sortFunction); | 910 result.sort(sortFunction); |
| 910 return result; | 911 return result; |
| 911 } | 912 } |
| OLD | NEW |