diff --git a/superset/assets/src/visualizations/nvd3_vis.js b/superset/assets/src/visualizations/nvd3_vis.js
index 4dcdb4087e..33694dddf4 100644
--- a/superset/assets/src/visualizations/nvd3_vis.js
+++ b/superset/assets/src/visualizations/nvd3_vis.js
@@ -324,13 +324,15 @@ export default function nvd3Vis(slice, payload) {
chart.showDistY(true);
chart.tooltip.contentGenerator(function (obj) {
const p = obj.point;
+ const yAxisFormatter = d3FormatPreset(fd.y_axis_format);
+ const xAxisFormatter = d3FormatPreset(fd.x_axis_format);
let s = '
';
s += (
`` +
`${p[fd.entity]} (${p.group})` +
' |
');
- s += row(fd.x, formatter(p.x));
- s += row(fd.y, formatter(p.y));
+ s += row(fd.x, xAxisFormatter(p.x));
+ s += row(fd.y, yAxisFormatter(p.y));
s += row(fd.size, formatter(p.size));
s += '
';
return s;
@@ -412,15 +414,13 @@ export default function nvd3Vis(slice, payload) {
chart.xAxis.tickFormat(xAxisFormatter);
}
- const yAxisFormatter = d3FormatPreset(fd.y_axis_format);
+ let yAxisFormatter = d3FormatPreset(fd.y_axis_format);
if (chart.yAxis && chart.yAxis.tickFormat) {
if (fd.contribution || fd.comparison_type === 'percentage') {
// When computing a "Percentage" or "Contribution" selected, we force a percentage format
- const percentageFormat = d3.format('.1%');
- chart.yAxis.tickFormat(percentageFormat);
- } else {
- chart.yAxis.tickFormat(yAxisFormatter);
+ yAxisFormatter = d3.format('.1%');
}
+ chart.yAxis.tickFormat(yAxisFormatter);
}
if (chart.y2Axis && chart.y2Axis.tickFormat) {
chart.y2Axis.tickFormat(yAxisFormatter);