Skip to content

Commit 727f913

Browse files
committed
Refactor title and subtitle selection in drawMainTitle function to use context-specific selection from the graph div (gd).
1 parent 04441f9 commit 727f913

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/plot_api/subroutines.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ exports.drawMainTitle = function(gd) {
428428
});
429429

430430
if(title.text && title.automargin) {
431-
var titleObj = d3.selectAll('.gtitle');
432-
var titleHeight = Drawing.bBox(d3.selectAll('.g-gtitle').node()).height;
431+
var titleObj = d3.select(gd).selectAll('.gtitle');
432+
var titleHeight = Drawing.bBox(d3.select(gd).selectAll('.g-gtitle').node()).height;
433433
var pushMargin = needsMarginPush(gd, title, titleHeight);
434434
if(pushMargin > 0) {
435435
applyTitleAutoMargin(gd, y, pushMargin, titleHeight);
@@ -455,7 +455,7 @@ exports.drawMainTitle = function(gd) {
455455
}
456456

457457
// If there is a subtitle
458-
var subtitleObj = d3.selectAll('.gtitle-subtitle');
458+
var subtitleObj = d3.select(gd).selectAll('.gtitle-subtitle');
459459
if(subtitleObj.node()) {
460460
// Get bottom edge of title bounding box
461461
var titleBB = titleObj.node().getBBox();

0 commit comments

Comments
 (0)