Bläddra i källkod

Graph: improved decimal precision in legend and graph hover when graph ticks use single decimal point, now graph legend and tooltip always use one more decimal precision than axis ticks (if axis ticks has decimals), Fixes #1072

Torkel Ödegaard 11 år sedan
förälder
incheckning
6c0f5329aa
1 ändrade filer med 6 tillägg och 1 borttagningar
  1. 6 1
      src/app/panels/graph/graph.js

+ 6 - 1
src/app/panels/graph/graph.js

@@ -115,7 +115,12 @@ function (angular, $, kbn, moment, _, GraphTooltip) {
             var series = data[i];
             var axis = yaxis[series.yaxis - 1];
             var formater = kbn.valueFormats[scope.panel.y_formats[series.yaxis - 1]];
-            series.updateLegendValues(formater, axis.tickDecimals, axis.scaledDecimals + 2);
+
+            // legend and tooltip gets one more decimal precision
+            // than graph legend ticks
+            var tickDecimals = (axis.tickDecimals || -1) + 1;
+
+            series.updateLegendValues(formater, tickDecimals, axis.scaledDecimals + 2);
             if(!scope.$$phase) { scope.$digest(); }
           }
         }