mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
[bug fix] Fixed forced percentage format on tooltips and bubble chart tooltips format. (#5631)
* fixed forced percentage format on tooltip and correct reflection on bubble chart tooltip format * re-trigger build
This commit is contained in:
parent
4c2be71e83
commit
2171ffb630
@ -324,13 +324,15 @@ export default function nvd3Vis(slice, payload) {
|
|||||||
chart.showDistY(true);
|
chart.showDistY(true);
|
||||||
chart.tooltip.contentGenerator(function (obj) {
|
chart.tooltip.contentGenerator(function (obj) {
|
||||||
const p = obj.point;
|
const p = obj.point;
|
||||||
|
const yAxisFormatter = d3FormatPreset(fd.y_axis_format);
|
||||||
|
const xAxisFormatter = d3FormatPreset(fd.x_axis_format);
|
||||||
let s = '<table>';
|
let s = '<table>';
|
||||||
s += (
|
s += (
|
||||||
`<tr><td style="color: ${p.color};">` +
|
`<tr><td style="color: ${p.color};">` +
|
||||||
`<strong>${p[fd.entity]}</strong> (${p.group})` +
|
`<strong>${p[fd.entity]}</strong> (${p.group})` +
|
||||||
'</td></tr>');
|
'</td></tr>');
|
||||||
s += row(fd.x, formatter(p.x));
|
s += row(fd.x, xAxisFormatter(p.x));
|
||||||
s += row(fd.y, formatter(p.y));
|
s += row(fd.y, yAxisFormatter(p.y));
|
||||||
s += row(fd.size, formatter(p.size));
|
s += row(fd.size, formatter(p.size));
|
||||||
s += '</table>';
|
s += '</table>';
|
||||||
return s;
|
return s;
|
||||||
@ -412,15 +414,13 @@ export default function nvd3Vis(slice, payload) {
|
|||||||
chart.xAxis.tickFormat(xAxisFormatter);
|
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 (chart.yAxis && chart.yAxis.tickFormat) {
|
||||||
if (fd.contribution || fd.comparison_type === 'percentage') {
|
if (fd.contribution || fd.comparison_type === 'percentage') {
|
||||||
// When computing a "Percentage" or "Contribution" selected, we force a percentage format
|
// When computing a "Percentage" or "Contribution" selected, we force a percentage format
|
||||||
const percentageFormat = d3.format('.1%');
|
yAxisFormatter = d3.format('.1%');
|
||||||
chart.yAxis.tickFormat(percentageFormat);
|
|
||||||
} else {
|
|
||||||
chart.yAxis.tickFormat(yAxisFormatter);
|
|
||||||
}
|
}
|
||||||
|
chart.yAxis.tickFormat(yAxisFormatter);
|
||||||
}
|
}
|
||||||
if (chart.y2Axis && chart.y2Axis.tickFormat) {
|
if (chart.y2Axis && chart.y2Axis.tickFormat) {
|
||||||
chart.y2Axis.tickFormat(yAxisFormatter);
|
chart.y2Axis.tickFormat(yAxisFormatter);
|
||||||
|
Loading…
Reference in New Issue
Block a user