You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "LuciferYang (via GitHub)" <gi...@apache.org> on 2023/12/14 09:54:33 UTC

Re: [PR] [SPARK-46384][SPARK-46404][SS][UI] Fix Operation Duration Stack Chart on Structured Streaming Page [spark]

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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org