Skip to content

Commit

Permalink
fix a bug in 'getMaxLabelSize' and x axis label not shown problem (#2694
Browse files Browse the repository at this point in the history
)

* fix

* fix code climate
  • Loading branch information
yileic authored and Alanna Scott committed Apr 28, 2017
1 parent c589616 commit ce70505
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion superset/assets/visualizations/nvd3_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ce70505

Please sign in to comment.