Skip to content

Commit 0621e43

Browse files
committed
update uirevisions for new title attribute structure #3276
1 parent d9b3aea commit 0621e43

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

src/plot_api/plot_api.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -2427,22 +2427,22 @@ exports._guiUpdate = guiEdit(update);
24272427
// Ordered by most common edits first, to minimize our search time
24282428
var layoutUIControlPatterns = [
24292429
{pattern: /^hiddenlabels/, attr: 'legend.uirevision'},
2430-
{pattern: /^((x|y)axis\d*)\.((auto)?range|title)/},
2430+
{pattern: /^((x|y)axis\d*)\.((auto)?range|title\.text)/},
24312431

24322432
// showspikes and modes include those nested inside scenes
24332433
{pattern: /axis\d*\.showspikes$/, attr: 'modebar.uirevision'},
24342434
{pattern: /(hover|drag)mode$/, attr: 'modebar.uirevision'},
24352435

24362436
{pattern: /^(scene\d*)\.camera/},
24372437
{pattern: /^(geo\d*)\.(projection|center)/},
2438-
{pattern: /^(ternary\d*\.[abc]axis)\.(min|title)$/},
2439-
{pattern: /^(polar\d*\.radialaxis)\.((auto)?range|angle|title)/},
2438+
{pattern: /^(ternary\d*\.[abc]axis)\.(min|title\.text)$/},
2439+
{pattern: /^(polar\d*\.radialaxis)\.((auto)?range|angle|title\.text)/},
24402440
{pattern: /^(polar\d*\.angularaxis)\.rotation/},
24412441
{pattern: /^(mapbox\d*)\.(center|zoom|bearing|pitch)/},
24422442

24432443
{pattern: /^legend\.(x|y)$/, attr: 'editrevision'},
24442444
{pattern: /^(shapes|annotations)/, attr: 'editrevision'},
2445-
{pattern: /^title$/, attr: 'editrevision'}
2445+
{pattern: /^title\.text$/, attr: 'editrevision'}
24462446
];
24472447

24482448
// same for trace attributes: if `attr` is given it's in layout,
@@ -2461,7 +2461,7 @@ var traceUIControlPatterns = [
24612461
// "name" also includes transform.styles
24622462
{pattern: /(^|value\.)name$/},
24632463
// including nested colorbar attributes (ie marker.colorbar)
2464-
{pattern: /colorbar\.title$/},
2464+
{pattern: /colorbar\.title\.text$/},
24652465
{pattern: /colorbar\.(x|y)$/, attr: 'editrevision'}
24662466
];
24672467

src/plots/polar/layout_attributes.js

+3
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ var radialAxisAttrs = {
136136
}
137137
};
138138

139+
// radial title is not gui-editable, so it needs dflt: '', similar to carpet axes.
140+
radialAxisAttrs.title.text.dflt = '';
141+
139142
extendFlat(
140143
radialAxisAttrs,
141144

test/jasmine/tests/plot_api_react_test.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ describe('Plotly.react and uirevision attributes', function() {
16431643
function editEditable() {
16441644
return Registry.call('_guiUpdate', gd,
16451645
{'colorbar.x': 0.8, 'colorbar.y': 0.6},
1646-
{title: 'yep', 'legend.x': 1.1, 'legend.y': 0.9},
1646+
{'title.text': 'yep', 'legend.x': 1.1, 'legend.y': 0.9},
16471647
[2]
16481648
);
16491649
}
@@ -1653,7 +1653,7 @@ describe('Plotly.react and uirevision attributes', function() {
16531653
'colorbar.x': original ? [undefined, 1.02] : 0.8,
16541654
'colorbar.y': original ? [undefined, 0.5] : 0.6
16551655
}], {
1656-
title: original ? [undefined, 'Click to enter Plot title'] : 'yep',
1656+
'title.text': original ? [undefined, 'Click to enter Plot title'] : 'yep',
16571657
'legend.x': original ? [undefined, 1.02] : 1.1,
16581658
'legend.y': original ? [undefined, 1] : 0.9
16591659
});
@@ -1688,7 +1688,7 @@ describe('Plotly.react and uirevision attributes', function() {
16881688
return {
16891689
'dimensions[0].constraintrange': original ? [[2.5, 3.5]] : [[[1.5, 2.5], [2.938, 3.979]]],
16901690
'dimensions[1].constraintrange': original ? undefined : [[6.937, 7.979]],
1691-
'line.colorbar.title': original ? [undefined, 'Click to enter Colorscale title'] : 'color',
1691+
'line.colorbar.title.text': original ? [undefined, 'Click to enter Colorscale title'] : 'color',
16921692
name: original ? [undefined, 'trace 0'] : 'name'
16931693
};
16941694
}
@@ -1700,7 +1700,7 @@ describe('Plotly.react and uirevision attributes', function() {
17001700
function editTrace() {
17011701
var _;
17021702
return Registry.call('_guiRestyle', gd,
1703-
{'line.colorbar.title': 'color', name: 'name'},
1703+
{'line.colorbar.title.text': 'color', name: 'name'},
17041704
[0]
17051705
)
17061706
.then(function() {
@@ -1742,12 +1742,12 @@ describe('Plotly.react and uirevision attributes', function() {
17421742

17431743
function attrs(original) {
17441744
return {
1745-
'xaxis.title': original ? [undefined, 'Click to enter X axis title'] : 'XXX',
1746-
'yaxis.title': original ? [undefined, 'Click to enter Y axis title'] : 'YYY',
1747-
'ternary.aaxis.title': original ? [undefined, 'Component A'] : 'AAA',
1748-
'ternary.baxis.title': original ? [undefined, 'Component B'] : 'BBB',
1749-
'ternary.caxis.title': original ? [undefined, 'Component C'] : 'CCC',
1750-
'polar.radialaxis.title': original ? [undefined, ''] : 'RRR'
1745+
'xaxis.title.text': original ? [undefined, 'Click to enter X axis title'] : 'XXX',
1746+
'yaxis.title.text': original ? [undefined, 'Click to enter Y axis title'] : 'YYY',
1747+
'ternary.aaxis.title.text': original ? [undefined, 'Component A'] : 'AAA',
1748+
'ternary.baxis.title.text': original ? [undefined, 'Component B'] : 'BBB',
1749+
'ternary.caxis.title.text': original ? [undefined, 'Component C'] : 'CCC',
1750+
'polar.radialaxis.title.text': original ? [undefined, ''] : 'RRR'
17511751
};
17521752
}
17531753

0 commit comments

Comments
 (0)