Why does my rectangular shape not show on my chart?


I’m trying to add a rectangular shape to my chart but it’s not showing up.

Here is the code by which I add the rectangle:

layout.shapes = _.map(regions, function(region) {
	return {
		type: 'rect',
		xref: 'x',
		yref: 'paper',
		y0: 0,
		y1: 1,
		x0: region.start, // 8/13/2023 12:01:00 AM
		x1: region.end,   // 8/15/2023 12:01:00 AM
		fillcolor: '#d3d3d3',
		opacity: 1.0,
		line: {
			width: 3

Here’s the series of events that need to occur.

  1. starting with the chart (a scatter plot):

original graph

  1. select a point with the lasso tool:

point selected

  1. delete the point:

point deleted

  1. draw the rectangular region:


It’s 4) that’s failing to occur. Can anyone see what I’m doing wrong?