Skip to content

Commit 7194259

Browse files
authored
Merge pull request #7215 from plotly/drop-annotations-ref
Drop support for deprecated `annotation.ref` attribute (use `annotation.xref` and `annotation.yref` instead)
2 parents 0ad7cfa + e77fce5 commit 7194259

File tree

10 files changed

+23
-42
lines changed

10 files changed

+23
-42
lines changed

draftlogs/7215_remove.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Drop support for deprecated `annotation.ref` attribute (use `annotation.xref` and `annotation.yref` instead) [[#7215](https://github.com/plotly/plotly.js/pull/7215)]

src/components/annotations/attributes.js

-10
Original file line numberDiff line numberDiff line change
@@ -487,14 +487,4 @@ module.exports = templatedArray('annotation', {
487487
].join(' ')
488488
},
489489
editType: 'calc',
490-
491-
_deprecated: {
492-
ref: {
493-
valType: 'string',
494-
editType: 'calc',
495-
description: [
496-
'Obsolete. Set `xref` and `yref` separately instead.'
497-
].join(' ')
498-
}
499-
}
500490
});

src/plot_api/helpers.js

-11
Original file line numberDiff line numberDiff line change
@@ -144,17 +144,6 @@ exports.cleanLayout = function(layout) {
144144

145145
if(!Lib.isPlainObject(ann)) continue;
146146

147-
if(ann.ref) {
148-
if(ann.ref === 'paper') {
149-
ann.xref = 'paper';
150-
ann.yref = 'paper';
151-
} else if(ann.ref === 'data') {
152-
ann.xref = 'x';
153-
ann.yref = 'y';
154-
}
155-
delete ann.ref;
156-
}
157-
158147
cleanAxRef(ann, 'xref');
159148
cleanAxRef(ann, 'yref');
160149
}

test/image/mocks/11.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@
214214
"xatype": "category",
215215
"yatype": "linear",
216216
"tag": "",
217-
"ref": "paper"
217+
"xref": "paper",
218+
"yref": "paper"
218219
}
219220
],
220221
"margin": {

test/image/mocks/14.json

+12-6
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@
167167
"xatype": "log",
168168
"yatype": "log",
169169
"tag": "",
170-
"ref": "plot"
170+
"xref": "plot",
171+
"yref": "plot"
171172
},
172173
{
173174
"x": 0.15585471975544452,
@@ -198,7 +199,8 @@
198199
"xatype": "log",
199200
"yatype": "log",
200201
"tag": "",
201-
"ref": "plot"
202+
"xref": "plot",
203+
"yref": "plot"
202204
},
203205
{
204206
"x": 1.8420351138192386,
@@ -229,7 +231,8 @@
229231
"xatype": "log",
230232
"yatype": "log",
231233
"tag": "",
232-
"ref": "plot"
234+
"xref": "plot",
235+
"yref": "plot"
233236
},
234237
{
235238
"x": -0.5537301200821234,
@@ -260,7 +263,8 @@
260263
"xatype": "log",
261264
"yatype": "log",
262265
"tag": "",
263-
"ref": "plot"
266+
"xref": "plot",
267+
"yref": "plot"
264268
},
265269
{
266270
"x": -2.701204903100102,
@@ -291,7 +295,8 @@
291295
"xatype": "log",
292296
"yatype": "log",
293297
"tag": "",
294-
"ref": "plot"
298+
"xref": "plot",
299+
"yref": "plot"
295300
},
296301
{
297302
"x": -1.6961577824283882,
@@ -322,7 +327,8 @@
322327
"xatype": "log",
323328
"yatype": "log",
324329
"tag": "",
325-
"ref": "plot"
330+
"xref": "plot",
331+
"yref": "plot"
326332
}
327333
],
328334
"margin": {

test/image/mocks/17.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,8 @@
612612
"xatype": "linear",
613613
"yatype": "linear",
614614
"tag": "",
615-
"ref": "plot"
615+
"xref": "plot",
616+
"yref": "plot"
616617
}
617618
],
618619
"margin": {

test/image/mocks/27.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@
329329
"xatype": "linear",
330330
"yatype": "linear",
331331
"tag": "",
332-
"ref": "plot"
332+
"xref": "plot",
333+
"yref": "plot"
333334
}
334335
],
335336
"margin": {

test/image/mocks/29.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -2256,7 +2256,8 @@
22562256
"xanchor": "auto",
22572257
"yanchor": "auto",
22582258
"tag": "",
2259-
"ref": "paper"
2259+
"xref": "paper",
2260+
"yref": "paper"
22602261
}
22612262
],
22622263
"margin": {

test/jasmine/tests/plot_api_test.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -2540,7 +2540,6 @@ describe('Test plot api', function() {
25402540

25412541
var layout = {
25422542
annotations: [
2543-
{ ref: 'paper' },
25442543
null,
25452544
{ xref: 'x02', yref: 'y1' }
25462545
],
@@ -2553,9 +2552,8 @@ describe('Test plot api', function() {
25532552

25542553
Plotly.newPlot(gd, data, layout);
25552554

2556-
expect(gd.layout.annotations[0]).toEqual({ xref: 'paper', yref: 'paper' });
2557-
expect(gd.layout.annotations[1]).toEqual(null);
2558-
expect(gd.layout.annotations[2]).toEqual({ xref: 'x2', yref: 'y' });
2555+
expect(gd.layout.annotations[0]).toEqual(null);
2556+
expect(gd.layout.annotations[1]).toEqual({ xref: 'x2', yref: 'y' });
25592557

25602558
expect(gd.layout.shapes[0].xref).toBeUndefined();
25612559
expect(gd.layout.shapes[0].yref).toBeUndefined();

test/plot-schema.json

-7
Original file line numberDiff line numberDiff line change
@@ -730,13 +730,6 @@
730730
"annotations": {
731731
"items": {
732732
"annotation": {
733-
"_deprecated": {
734-
"ref": {
735-
"description": "Obsolete. Set `xref` and `yref` separately instead.",
736-
"editType": "calc",
737-
"valType": "string"
738-
}
739-
},
740733
"align": {
741734
"description": "Sets the horizontal alignment of the `text` within the box. Has an effect only if `text` spans two or more lines (i.e. `text` contains one or more <br> HTML tags) or if an explicit width is set to override the text width.",
742735
"dflt": "center",

0 commit comments

Comments
 (0)