瀏覽代碼

heatmap: format numeric tick labels in tsbuckets mode

Alexander Zobnin 7 年之前
父節點
當前提交
76c684cc01
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      public/app/plugins/panel/heatmap/rendering.ts

+ 9 - 1
public/app/plugins/panel/heatmap/rendering.ts

@@ -305,7 +305,15 @@ export default function link(scope, elem, attrs, ctrl) {
       .range([chartHeight, 0]);
 
     const tick_values = _.map(tsBuckets, (b, i) => i);
-    const tickFormatter = val => tsBuckets[val];
+
+    function tickFormatter(valIndex) {
+      let valueFormatted = tsBuckets[valIndex];
+      if (!_.isNaN(_.toNumber(valueFormatted)) && valueFormatted !== '') {
+        // Try to format numeric tick labels
+        valueFormatted = tickValueFormatter(0)(valueFormatted);
+      }
+      return valueFormatted;
+    }
 
     let yAxis = d3
       .axisLeft(yScale)