Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(layout-subtitle): fix layout.title.subtitle does not properly c…
…lear/remove from the chart
  • Loading branch information
cminn10 committed Oct 5, 2025
commit 270613ca564b0b137d3d3c8b09e27d17068a6f3c
8 changes: 4 additions & 4 deletions src/components/titles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function draw(gd, titleClass, options) {
var subtitleEnabled = !!subtitleProp;
var subtitlePlaceholder = options.subtitlePlaceholder;
var subtitle = (cont.title || {}).subtitle || {text: '', font: {}};
var subtitleTxt = subtitle.text.trim();
var subtitleTxt = (subtitle.text || '').trim();
var subtitleIsPlaceholder = false;
var subtitleOpacity = 1;

Expand Down Expand Up @@ -160,7 +160,7 @@ function draw(gd, titleClass, options) {
var subtitleClass = titleClass + '-subtitle';
var subtitleElShouldExist = subtitleTxt || editable;

if(subtitleEnabled && subtitleElShouldExist) {
if(subtitleEnabled) {
subtitleEl = group.selectAll('text.' + subtitleClass)
.data(subtitleElShouldExist ? [0] : []);
subtitleEl.enter().append('text');
Expand Down Expand Up @@ -231,7 +231,7 @@ function draw(gd, titleClass, options) {
.attr(attributes)
.call(svgTextUtils.convertToTspans, gd, adjustSubtitlePosition);

if(subtitleEl) {
if(subtitleEl && !subtitleEl.empty()) {
// Set subtitle y position based on bottom of title
// We need to check the Mathjax group as well, in case the Mathjax
// has already rendered
Expand Down Expand Up @@ -405,7 +405,7 @@ function draw(gd, titleClass, options) {
}

el.classed('js-placeholder', titleIsPlaceholder);
if(subtitleEl) subtitleEl.classed('js-placeholder', subtitleIsPlaceholder);
if(subtitleEl && !subtitleEl.empty()) subtitleEl.classed('js-placeholder', subtitleIsPlaceholder);

return group;
}
Expand Down