OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @unrestricted | 32 * @unrestricted |
33 */ | 33 */ |
34 UI.PieChart = class { | 34 PerfUI.PieChart = class { |
35 /** | 35 /** |
36 * @param {number} size | 36 * @param {number} size |
37 * @param {function(number):string=} formatter | 37 * @param {function(number):string=} formatter |
38 * @param {boolean=} showTotal | 38 * @param {boolean=} showTotal |
39 */ | 39 */ |
40 constructor(size, formatter, showTotal) { | 40 constructor(size, formatter, showTotal) { |
41 this.element = createElement('div'); | 41 this.element = createElement('div'); |
42 this._shadowRoot = UI.createShadowRootWithCoreStyles(this.element, 'ui_lazy/
pieChart.css'); | 42 this._shadowRoot = UI.createShadowRootWithCoreStyles(this.element, 'perf_ui/
pieChart.css'); |
43 var root = this._shadowRoot.createChild('div', 'root'); | 43 var root = this._shadowRoot.createChild('div', 'root'); |
44 var svg = this._createSVGChild(root, 'svg'); | 44 var svg = this._createSVGChild(root, 'svg'); |
45 this._group = this._createSVGChild(svg, 'g'); | 45 this._group = this._createSVGChild(svg, 'g'); |
46 var background = this._createSVGChild(this._group, 'circle'); | 46 var background = this._createSVGChild(this._group, 'circle'); |
47 background.setAttribute('r', 1.01); | 47 background.setAttribute('r', 1.01); |
48 background.setAttribute('fill', 'hsl(0, 0%, 90%)'); | 48 background.setAttribute('fill', 'hsl(0, 0%, 90%)'); |
49 this._foregroundElement = root.createChild('div', 'pie-chart-foreground'); | 49 this._foregroundElement = root.createChild('div', 'pie-chart-foreground'); |
50 if (showTotal) | 50 if (showTotal) |
51 this._totalElement = this._foregroundElement.createChild('div', 'pie-chart
-total'); | 51 this._totalElement = this._foregroundElement.createChild('div', 'pie-chart
-total'); |
52 this._formatter = formatter; | 52 this._formatter = formatter; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 * @param {!Element} parent | 107 * @param {!Element} parent |
108 * @param {string} childType | 108 * @param {string} childType |
109 * @return {!Element} | 109 * @return {!Element} |
110 */ | 110 */ |
111 _createSVGChild(parent, childType) { | 111 _createSVGChild(parent, childType) { |
112 var child = parent.ownerDocument.createElementNS('http://www.w3.org/2000/svg
', childType); | 112 var child = parent.ownerDocument.createElementNS('http://www.w3.org/2000/svg
', childType); |
113 parent.appendChild(child); | 113 parent.appendChild(child); |
114 return child; | 114 return child; |
115 } | 115 } |
116 }; | 116 }; |
OLD | NEW |