]> jspc29.x-matter.uni-frankfurt.de Git - mvd_epics.git/commitdiff
DASH: properly plot horizontal lines
authorPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Thu, 24 Aug 2017 11:40:06 +0000 (13:40 +0200)
committerPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Thu, 24 Aug 2017 11:40:06 +0000 (13:40 +0200)
python_suite/dashboard/static/js/sparkline.js

index c4bc8a009b6901c02b3edae2898b2337fe963f55..c3a1e3eb087d3d13daa94d4464d536a51409b8fb 100644 (file)
@@ -90,6 +90,7 @@ function sparkline() {
           .attr("y1", "0%")   // starting y point
           .attr("x2", "0%")   // ending x point
           .attr("y2", "100%") // ending y point
+          .attr("gradientUnits", "userSpaceOnUse")
           .attr("spreadMethod", "pad");
 
       chart.gradientColors().forEach(function (color, index) {
@@ -124,7 +125,9 @@ function sparkline() {
 
       // Scale the range of the data
       x.domain(d3.extent(data, function (d) { return d[0]; }));
-      y.domain(d3.extent(data, function (d) { return d[1]; }));
+      var extent = d3.extent(data, function (d) { return d[1]; });
+      if (extent[0] == extent[1]) extent = [ extent[0]-.5, extent[0]+.5];
+      y.domain(extent);
 
 
       // Add the valueline path.