Skip to content

Commit 73cd576

Browse files
committed
fix undefined and null textposition inputs for scatter plot
1 parent f804dae commit 73cd576

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/plot_api/helpers.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,14 @@ function commonPrefix(name1, name2, show1, show2) {
439439
function cleanTextPosition(textposition) {
440440
var posY = 'middle',
441441
posX = 'center';
442-
if(textposition.indexOf('top') !== -1) posY = 'top';
443-
else if(textposition.indexOf('bottom') !== -1) posY = 'bottom';
444442

445-
if(textposition.indexOf('left') !== -1) posX = 'left';
446-
else if(textposition.indexOf('right') !== -1) posX = 'right';
443+
if(textposition !== undefined && textposition !== null) {
444+
if(textposition.indexOf('top') !== -1) posY = 'top';
445+
else if(textposition.indexOf('bottom') !== -1) posY = 'bottom';
446+
447+
if(textposition.indexOf('left') !== -1) posX = 'left';
448+
else if(textposition.indexOf('right') !== -1) posX = 'right';
449+
}
447450

448451
return posY + ' ' + posX;
449452
}

0 commit comments

Comments
 (0)