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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @param {number} size | 33 * @param {number} size |
34 * @param {function(number):string=} formatter | 34 * @param {function(number):string=} formatter |
35 */ | 35 */ |
36 WebInspector.PieChart = function(size, formatter) | 36 WebInspector.PieChart = function(size, formatter) |
37 { | 37 { |
38 var shadowSize = WebInspector.PieChart._ShadowSizePercent; | 38 var shadowSize = WebInspector.PieChart._ShadowSizePercent; |
39 this.element = document.createElementWithClass("div", "pie-chart"); | 39 this.element = createElementWithClass("div", "pie-chart"); |
40 this.element.appendChild(WebInspector.View.createStyleElement("pieChart.css"
)); | 40 this.element.appendChild(WebInspector.View.createStyleElement("pieChart.css"
)); |
41 var svg = this._createSVGChild(this.element, "svg"); | 41 var svg = this._createSVGChild(this.element, "svg"); |
42 svg.setAttribute("width", (100 * (1 + 2 * shadowSize)) + "%"); | 42 svg.setAttribute("width", (100 * (1 + 2 * shadowSize)) + "%"); |
43 svg.setAttribute("height", (100 * (1 + 2 * shadowSize)) + "%"); | 43 svg.setAttribute("height", (100 * (1 + 2 * shadowSize)) + "%"); |
44 this._group = this._createSVGChild(svg, "g"); | 44 this._group = this._createSVGChild(svg, "g"); |
45 var shadow = this._createSVGChild(this._group, "circle"); | 45 var shadow = this._createSVGChild(this._group, "circle"); |
46 shadow.setAttribute("r", 1 + shadowSize); | 46 shadow.setAttribute("r", 1 + shadowSize); |
47 shadow.setAttribute("cy", shadowSize); | 47 shadow.setAttribute("cy", shadowSize); |
48 shadow.setAttribute("fill", "hsl(0,0%,70%)"); | 48 shadow.setAttribute("fill", "hsl(0,0%,70%)"); |
49 var background = this._createSVGChild(this._group, "circle"); | 49 var background = this._createSVGChild(this._group, "circle"); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 * @param {string} childType | 115 * @param {string} childType |
116 * @return {!Element} | 116 * @return {!Element} |
117 */ | 117 */ |
118 _createSVGChild: function(parent, childType) | 118 _createSVGChild: function(parent, childType) |
119 { | 119 { |
120 var child = document.createElementNS("http://www.w3.org/2000/svg", child
Type); | 120 var child = document.createElementNS("http://www.w3.org/2000/svg", child
Type); |
121 parent.appendChild(child); | 121 parent.appendChild(child); |
122 return child; | 122 return child; |
123 } | 123 } |
124 } | 124 } |
OLD | NEW |