* @constructor
* @param {number} size
* @param {function(number):string=} formatter
+ * @param {boolean=} showTotal
*/
-WebInspector.PieChart = function(size, formatter)
+WebInspector.PieChart = function(size, formatter, showTotal)
{
var shadowSize = WebInspector.PieChart._ShadowSizePercent;
- this.element = document.createElementWithClass("div", "pie-chart");
- this.element.appendChild(WebInspector.View.createStyleElement("pieChart.css"));
+ this.element = createElementWithClass("div", "pie-chart");
+ this.element.appendChild(WebInspector.View.createStyleElement("ui/pieChart.css"));
var svg = this._createSVGChild(this.element, "svg");
svg.setAttribute("width", (100 * (1 + 2 * shadowSize)) + "%");
svg.setAttribute("height", (100 * (1 + 2 * shadowSize)) + "%");
background.setAttribute("r", 1);
background.setAttribute("fill", "hsl(0,0%,92%)");
this._foregroundElement = this.element.createChild("div", "pie-chart-foreground");
- this._totalElement = this._foregroundElement.createChild("div", "pie-chart-total");
+ if (showTotal)
+ this._totalElement = this._foregroundElement.createChild("div", "pie-chart-total");
this._formatter = formatter;
this._slices = [];
this._lastAngle = -Math.PI/2;
totalString = this._formatter ? this._formatter(totalValue) : totalValue;
else
totalString = "";
- this._totalElement.textContent = totalString;
+ if (this._totalElement)
+ this._totalElement.textContent = totalString;
},
/**
* @param {!Element} parent
* @param {string} childType
* @return {!Element}
+ * @suppressGlobalPropertiesCheck
*/
_createSVGChild: function(parent, childType)
{