Title: [189183] trunk/Source/WebInspectorUI
Revision
189183
Author
[email protected]
Date
2015-08-31 13:57:49 -0700 (Mon, 31 Aug 2015)

Log Message

Web Inspector: Rendering Frame tasks making up < 1% of the selection don't appear in the pie chart
https://bugs.webkit.org/show_bug.cgi?id=148549

Reviewed by Timothy Hatcher.

Small data points can be invisible or difficult to see in the pie chart. This patch introduces
a minimum slice size of 1.5% (determined by visual inspection) for chart items.

Legend items continue to show the original data point values, not the adjusted values used to
draw the chart slices.

* UserInterface/Views/ChartDetailsSectionRow.js:
(WebInspector.ChartDetailsSectionRow):
(WebInspector.ChartDetailsSectionRow.prototype._updateLayout):
Adjust display values up or down as needed, so no data point is less than the
minimum and all chart slices still total 100%.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (189182 => 189183)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-08-31 20:41:34 UTC (rev 189182)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-08-31 20:57:49 UTC (rev 189183)
@@ -1,3 +1,22 @@
+2015-08-31  Matt Baker  <[email protected]>
+
+        Web Inspector: Rendering Frame tasks making up < 1% of the selection don't appear in the pie chart
+        https://bugs.webkit.org/show_bug.cgi?id=148549
+
+        Reviewed by Timothy Hatcher.
+
+        Small data points can be invisible or difficult to see in the pie chart. This patch introduces
+        a minimum slice size of 1.5% (determined by visual inspection) for chart items.
+
+        Legend items continue to show the original data point values, not the adjusted values used to
+        draw the chart slices.
+
+        * UserInterface/Views/ChartDetailsSectionRow.js:
+        (WebInspector.ChartDetailsSectionRow):
+        (WebInspector.ChartDetailsSectionRow.prototype._updateLayout):
+        Adjust display values up or down as needed, so no data point is less than the
+        minimum and all chart slices still total 100%.
+
 2015-08-28  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: "animationEnd" event names should be "animationend" (broken dashboard animation after pause)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ChartDetailsSectionRow.js (189182 => 189183)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ChartDetailsSectionRow.js	2015-08-31 20:41:34 UTC (rev 189182)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ChartDetailsSectionRow.js	2015-08-31 20:57:49 UTC (rev 189183)
@@ -318,6 +318,41 @@
             ].join(" ");
         }
 
+        // Balance item values so that all non-zero chart segments are visible.
+        const minimumDisplayValue = this._total * 0.015;
+
+        let items = [];
+        for (let item of this._items.values()) {
+            item.displayValue = item.value ? Math.max(minimumDisplayValue, item.value) : 0;
+            if (item.displayValue)
+                items.push(item);
+        }
+
+        if (items.length > 1) {
+            items.sort(function(a, b) { return a.value - b.value; });
+
+            let largeItemCount = items.length;
+            let totalAdjustedValue = 0;
+            for (let item of items) {
+                if (item.value < minimumDisplayValue) {
+                    totalAdjustedValue += minimumDisplayValue - item.value;
+                    largeItemCount--;
+                    continue;
+                }
+
+                if (!totalAdjustedValue || !largeItemCount)
+                    break;
+
+                const donatedValue = totalAdjustedValue / largeItemCount;
+                if (item.displayValue - donatedValue >= minimumDisplayValue) {
+                    item.displayValue -= donatedValue;
+                    totalAdjustedValue -= donatedValue;
+                }
+
+                largeItemCount--;
+            }
+        }
+
         const center = this._chartSize / 2;
         let startAngle = -Math.PI / 2;
         let endAngle = 0;
@@ -337,7 +372,7 @@
                 continue;
             }
 
-            const angle = (item.value / this._total) * Math.PI * 2;
+            const angle = (item.displayValue / this._total) * Math.PI * 2;
             endAngle = startAngle + angle;
 
             path.setAttribute("d", createSegmentPathData(center, startAngle, endAngle, this._radius, this._innerRadius));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to