scalefreeX = (options) =>
Plot.initializer(options, (data, facets, channels, scales, dimensions) => {
const {
x1: { value: X1 },
x2: { value: X2 }
} = channels;
for (const index of facets) {
const x = d3.scaleUtc(
d3.extent(Array.from(index, (i) => [X1[i], X2[i]]).flat()),
[dimensions.marginLeft, dimensions.width - dimensions.marginRight]
);
for (const i of index) (X1[i] = x(X1[i])), (X2[i] = x(X2[i]));
}
return { data, facets, channels: { x1: { value: X1 }, x2: { value: X2 } } };
})