LuciferYang commented on code in PR #44346:
URL: https://github.com/apache/spark/pull/44346#discussion_r1426483924


##########
core/src/main/resources/org/apache/spark/ui/static/structured-streaming-page.js:
##########
@@ -37,32 +41,34 @@ function drawAreaStack(id, labels, values, minX, maxX, 
minY, maxY) {
     .append("g")
     .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
 
-  var data = values;
-
-  var parse = d3.timeParse("%H:%M:%S.%L");
-
-  // Transpose the data into layers
-  var dataset = d3.stack()(labels.map(function(fruit) {
-    return data.map(function(d) {
-      return {_x: d.x, x: parse(d.x), y: +d[fruit]};
+  var data = values.flatMap(function(d) {

Review Comment:
   how about 
   
   ```javascript
   const data = values.flatMap(d => {
     return Object.keys(d).filter(key => key !== 'x').map(key => {
         const duration = +d[key];
         return {x: d.x, label: key, duration};
       });
     });
   ```



##########
core/src/main/resources/org/apache/spark/ui/static/streaming-page.js:
##########
@@ -37,14 +42,22 @@ var unitLabelYOffset = -10;
 var onClickTimeline = function() {};
 
 // Show a tooltip "text" for "node"
-function showBootstrapTooltip(node, text) {
-  $(node).tooltip({title: text, trigger: "manual", container: "body"});
-  $(node).tooltip("show");
+function showBootstrapTooltip(d3Selection, text) {
+  d3Selection.each(function() {
+    $(this).tooltip({title: text, trigger: "manual", container: "body"});
+    $(this).tooltip("show");
+  });

Review Comment:
   how about 
   
   ```javascript
   function showBootstrapTooltip(d3Selection, text) {
     d3Selection.each(function() {
       const $this = $(this);
       $this.tooltip({title: text, trigger: "manual", container: 
"body"}).tooltip("show");
     });
   }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to