Skip to content

Commit

Permalink
[vis] bar values should match y axis format (#2701)
Browse files Browse the repository at this point in the history
It passes the user yAxis format value to the totalValue function to render the label text accordingly
  • Loading branch information
justinpark authored and mistercrunch committed May 1, 2017
1 parent ef0c4be commit 5fd0e7d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions superset/assets/visualizations/nvd3_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 5fd0e7d

Please sign in to comment.