From 76c684cc0114e48cb56253d4becc4bfd2a235a82 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Wed, 28 Feb 2018 16:19:58 +0300 Subject: [PATCH] heatmap: format numeric tick labels in tsbuckets mode --- public/app/plugins/panel/heatmap/rendering.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/panel/heatmap/rendering.ts b/public/app/plugins/panel/heatmap/rendering.ts index fe2aa46a584..a7c55094e75 100644 --- a/public/app/plugins/panel/heatmap/rendering.ts +++ b/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)