Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Unified Diff: third_party/WebKit/Source/devtools/front_end/perf_ui/PieChart.js

Issue 2664463002: DevTools: Turn pie chart into a donut chart. (Closed)
Patch Set: fix ESLint Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/perf_ui/PieChart.js
diff --git a/third_party/WebKit/Source/devtools/front_end/perf_ui/PieChart.js b/third_party/WebKit/Source/devtools/front_end/perf_ui/PieChart.js
index eedbd72670e805bc2db3d42116e9b642b6b4aa49..bb6fa81850c54c5f080713cacf6139a4547f45eb 100644
--- a/third_party/WebKit/Source/devtools/front_end/perf_ui/PieChart.js
+++ b/third_party/WebKit/Source/devtools/front_end/perf_ui/PieChart.js
@@ -43,9 +43,18 @@ PerfUI.PieChart = class {
var root = this._shadowRoot.createChild('div', 'root');
var svg = this._createSVGChild(root, 'svg');
this._group = this._createSVGChild(svg, 'g');
- var background = this._createSVGChild(this._group, 'circle');
- background.setAttribute('r', 1.01);
- background.setAttribute('fill', 'hsl(0, 0%, 90%)');
+ this._innerR = 0.618;
+ var strokeWidth = 1 / size;
+ var circle = this._createSVGChild(this._group, 'circle');
+ circle.setAttribute('r', 1);
+ circle.setAttribute('stroke', 'hsl(0, 0%, 80%)');
+ circle.setAttribute('fill', 'transparent');
+ circle.setAttribute('stroke-width', strokeWidth);
+ circle = this._createSVGChild(this._group, 'circle');
+ circle.setAttribute('r', this._innerR);
+ circle.setAttribute('stroke', 'hsl(0, 0%, 80%)');
+ circle.setAttribute('fill', 'transparent');
+ circle.setAttribute('stroke-width', strokeWidth);
this._foregroundElement = root.createChild('div', 'pie-chart-foreground');
if (showTotal)
this._totalElement = this._foregroundElement.createChild('div', 'pie-chart-total');
@@ -97,8 +106,14 @@ PerfUI.PieChart = class {
this._lastAngle += sliceAngle;
var x2 = Math.cos(this._lastAngle);
var y2 = Math.sin(this._lastAngle);
+ var r2 = this._innerR;
+ var x3 = x2 * r2;
+ var y3 = y2 * r2;
+ var x4 = x1 * r2;
+ var y4 = y1 * r2;
var largeArc = sliceAngle > Math.PI ? 1 : 0;
- path.setAttribute('d', 'M0,0 L' + x1 + ',' + y1 + ' A1,1,0,' + largeArc + ',1,' + x2 + ',' + y2 + ' Z');
+ path.setAttribute('d',
+ `M${x1},${y1} A1,1,0,${largeArc},1,${x2},${y2} L${x3},${y3} A${r2},${r2},0,${largeArc},0,${x4},${y4} Z`);
path.setAttribute('fill', color);
this._slices.push(path);
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698