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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 var background = this._createSVGChild(this._group, "circle"); | 44 var background = this._createSVGChild(this._group, "circle"); |
45 background.setAttribute("r", 1.01); | 45 background.setAttribute("r", 1.01); |
46 background.setAttribute("fill", "hsl(0, 0%, 90%)"); | 46 background.setAttribute("fill", "hsl(0, 0%, 90%)"); |
47 this._foregroundElement = root.createChild("div", "pie-chart-foreground"); | 47 this._foregroundElement = root.createChild("div", "pie-chart-foreground"); |
48 if (showTotal) | 48 if (showTotal) |
49 this._totalElement = this._foregroundElement.createChild("div", "pie-cha
rt-total"); | 49 this._totalElement = this._foregroundElement.createChild("div", "pie-cha
rt-total"); |
50 this._formatter = formatter; | 50 this._formatter = formatter; |
51 this._slices = []; | 51 this._slices = []; |
52 this._lastAngle = -Math.PI / 2; | 52 this._lastAngle = -Math.PI / 2; |
53 this._setSize(size); | 53 this._setSize(size); |
54 } | 54 }; |
55 | 55 |
56 WebInspector.PieChart.prototype = { | 56 WebInspector.PieChart.prototype = { |
57 /** | 57 /** |
58 * @param {number} totalValue | 58 * @param {number} totalValue |
59 */ | 59 */ |
60 setTotal: function(totalValue) | 60 setTotal: function(totalValue) |
61 { | 61 { |
62 for (var i = 0; i < this._slices.length; ++i) | 62 for (var i = 0; i < this._slices.length; ++i) |
63 this._slices[i].remove(); | 63 this._slices[i].remove(); |
64 this._slices = []; | 64 this._slices = []; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 * @param {!Element} parent | 109 * @param {!Element} parent |
110 * @param {string} childType | 110 * @param {string} childType |
111 * @return {!Element} | 111 * @return {!Element} |
112 */ | 112 */ |
113 _createSVGChild: function(parent, childType) | 113 _createSVGChild: function(parent, childType) |
114 { | 114 { |
115 var child = parent.ownerDocument.createElementNS("http://www.w3.org/2000
/svg", childType); | 115 var child = parent.ownerDocument.createElementNS("http://www.w3.org/2000
/svg", childType); |
116 parent.appendChild(child); | 116 parent.appendChild(child); |
117 return child; | 117 return child; |
118 } | 118 } |
119 } | 119 }; |
OLD | NEW |