]> jspc29.x-matter.uni-frankfurt.de Git - mvd_epics.git/commitdiff
DASH: create random ID for each sparkline gradient
authorPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Tue, 12 Sep 2017 16:07:05 +0000 (18:07 +0200)
committerPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Tue, 12 Sep 2017 16:07:29 +0000 (18:07 +0200)
python_suite/dashboard/static/js/sparkline.js

index d3f1b5d12d7595c887cc0b582fa9f58e81841e21..e17f7d13c72dc2849d852aea2ef1e67cab899ecc 100644 (file)
@@ -14,6 +14,7 @@ function sparkline() {
   var dataSource = '';
   var dataSourceType = '';
   var selector = 'body';
+  var id = Math.floor(Math.random()*16777215).toString(16);
   var gradientColors = ['green', 'orange', 'red'];
 
   // setters and getters
@@ -96,7 +97,7 @@ function sparkline() {
       // this defines the gradient used
       gradient = svg.append("defs")
         .append("linearGradient")
-          .attr("id", "gradient")
+          .attr("id", "gradient"+id)
           .attr("x1", "0%")   // starting x point
           .attr("y1", "0%")   // starting y point
           .attr("x2", "0%")   // ending x point
@@ -143,7 +144,7 @@ function sparkline() {
         .attr('class', 'line')
         .attr('stroke', function () {
           if (gradient) {
-            return 'url(#gradient)';
+            return 'url(#gradient'+id+')';
           }
           return '#444444';
         })