Преглед изворни кода

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 година
родитељ
комит
6c0f5329aa
1 измењених фајлова са 6 додато и 1 уклоњено
  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(); }
           }
         }