@tanstack/charts
Version:
A chart grammar for TypeScript and JavaScript. Marks consume your data directly, channels describe visual encodings, and the engine compiles them into a renderer-neutral keyed scene. TanStack's compact scales cover common numeric and categorical mappings.
22 lines (21 loc) • 621 B
JavaScript
const positionChannel = /* @__PURE__ */ Symbol();
function readMaterializedPositionChannel(name, channel) {
if (name === "x" || name === "y") return name;
return channel[positionChannel];
}
function preserveMaterializedPositionChannel(name, channel) {
const position = readMaterializedPositionChannel(name, channel);
if (position === void 0) return channel;
if (channel[positionChannel] === position) {
return channel;
}
const positioned = {
...channel,
[positionChannel]: position
};
return positioned;
}
export {
preserveMaterializedPositionChannel,
readMaterializedPositionChannel
};