mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix a bug in 'getMaxLabelSize' and x axis label not shown problem (#2694)
* fix * fix code climate
This commit is contained in:
@@ -72,7 +72,7 @@ function hideTooltips() {
|
||||
function getMaxLabelSize(container, axisClass) {
|
||||
// axis class = .nv-y2 // second y axis on dual line chart
|
||||
// axis class = .nv-x // x axis on time series line chart
|
||||
const labelEls = container.find(`.${axisClass} text`);
|
||||
const labelEls = container.find(`.${axisClass} text`).not('.nv-axislabel');
|
||||
const labelDimensions = labelEls.map(i => labelEls[i].getComputedTextLength());
|
||||
return Math.max(...labelDimensions);
|
||||
}
|
||||
@@ -430,6 +430,9 @@ function nvd3Vis(slice, payload) {
|
||||
|
||||
// apply margins
|
||||
chart.margin(chartMargins);
|
||||
if (fd.x_axis_label && fd.x_axis_label !== '' && chart.xAxis) {
|
||||
chart.margin({ bottom: maxXAxisLabelHeight + marginPad + 25 });
|
||||
}
|
||||
|
||||
// render chart
|
||||
svg
|
||||
|
||||
Reference in New Issue
Block a user