Simple rectangles

<Plot grid inset={10}>
    <CustomMark {data} x1="x1" x2="x2" y1="y1" y2="y2">
        {#snippet mark({ record })}
            <rect
                x={Math.min(record.x1, record.x2)}
                y={Math.min(record.y1, record.y2)}
                width={Math.abs(record.x2 - record.x1)}
                height={Math.abs(record.y2 - record.y1)}
                stroke="currentColor"
                fill="currentColor"
                fill-opacity="0.5" />
        {/snippet}
    </CustomMark>
</Plot>

Open in Svelte playground