]> jspc29.x-matter.uni-frankfurt.de Git - mvd_epics.git/commitdiff
DASH: hide focus for plots with NO value
authorPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Tue, 29 Aug 2017 10:03:58 +0000 (12:03 +0200)
committerPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Tue, 29 Aug 2017 10:03:58 +0000 (12:03 +0200)
python_suite/dashboard/static/js/sparkline.js

index 04bcc8487f598ec1371847a95678f1d33b743966..d3f1b5d12d7595c887cc0b582fa9f58e81841e21 100644 (file)
@@ -164,6 +164,7 @@ function sparkline() {
             
       var focus = svg.append("g")
           .attr("class", "focus")
+          .attr("transform", "translate(-10,-10)")
           .style("display", "none");
 
       focus.append("circle")
@@ -191,13 +192,15 @@ function sparkline() {
         var d = x0 - d0[0] > d1[0] - x0 ? d1 : d0;
         //console.log(x(d[0]));
         //console.log(y(d[1]));
-        focus.attr("transform", "translate(" + x(d[0]) + "," + y(d[1]) + ")");
         var val = d[1];
-        if (precision != null)
+        if (val != null && precision != null)
           val = val.toFixed(precision);
-        tooltip_val.text(val);
-        var iso_date = d[0].toISOString();
-        tooltip_ts.text(iso_date.slice(11, 11+10));
+        if (val != null) {
+          focus.attr("transform", "translate(" + x(d[0]) + "," + y(d[1]) + ")");
+          tooltip_val.text(val);
+          var iso_date = d[0].toISOString();
+          tooltip_ts.text(iso_date.slice(11, 11+10));
+        }
       }
     }
   }