From 5fd0e7d02828df4bb02b6a3b34779517fe637123 Mon Sep 17 00:00:00 2001 From: Justin Park Date: Mon, 1 May 2017 08:59:02 -0700 Subject: [PATCH] [vis] bar values should match y axis format (#2701) It passes the user yAxis format value to the totalValue function to render the label text accordingly --- superset/assets/visualizations/nvd3_vis.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/superset/assets/visualizations/nvd3_vis.js b/superset/assets/visualizations/nvd3_vis.js index 6bc45e401992d..aa49d437f560b 100644 --- a/superset/assets/visualizations/nvd3_vis.js +++ b/superset/assets/visualizations/nvd3_vis.js @@ -23,8 +23,8 @@ const BREAKPOINTS = { small: 340, }; -const addTotalBarValues = function (svg, chart, data, stacked) { - const format = d3.format('.3s'); +const addTotalBarValues = function (svg, chart, data, stacked, axisFormat) { + const format = d3.format(axisFormat || '.3s'); const countSeriesDisplayed = data.length; const totalStackedValues = stacked && data.length !== 0 ? @@ -169,7 +169,7 @@ function nvd3Vis(slice, payload) { if (fd.show_bar_value) { setTimeout(function () { - addTotalBarValues(svg, chart, payload.data, stacked); + addTotalBarValues(svg, chart, payload.data, stacked, fd.y_axis_format); }, animationTime); } break; @@ -199,7 +199,7 @@ function nvd3Vis(slice, payload) { } if (fd.show_bar_value) { setTimeout(function () { - addTotalBarValues(svg, chart, payload.data, stacked); + addTotalBarValues(svg, chart, payload.data, stacked, fd.y_axis_format); }, animationTime); } if (!reduceXTicks) {