diff --git a/src/marks/tip.js b/src/marks/tip.js index bfb9d04cb2..8277a79215 100644 --- a/src/marks/tip.js +++ b/src/marks/tip.js @@ -347,8 +347,8 @@ function getSourceChannels(channels, scales) { if ((key === "x" || key === "y") && channels.geometry) continue; // ignore x & y on geo const source = getSource(channels, key); if (source) { - // Ignore color channels if the values are all literal colors. - if (source.scale == null && source.defaultScale === "color") continue; + // Ignore (e.g., color) channels if the values are all literal. + if (source.scale == null && source.defaultScale) continue; sources[key] = source; } } diff --git a/test/output/explicitSymbol.svg b/test/output/explicitSymbol.svg new file mode 100644 index 0000000000..f8364cb5be --- /dev/null +++ b/test/output/explicitSymbol.svg @@ -0,0 +1,378 @@ + + + + + 35 + 40 + 45 + 50 + 55 + + + culmen_length_mm → + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plots/explicit-symbol.ts b/test/plots/explicit-symbol.ts new file mode 100644 index 0000000000..446a864aad --- /dev/null +++ b/test/plots/explicit-symbol.ts @@ -0,0 +1,21 @@ +import * as Plot from "@observablehq/plot"; +import * as d3 from "d3"; + +// A channel of explicit symbols does not show in the tip nor has a legend. +export async function explicitSymbol() { + const penguins = await d3.csv("data/penguins.csv", d3.autoType); + return Plot.plot({ + height: 220, + symbol: {legend: true}, + marks: [ + Plot.dot( + penguins, + Plot.dodgeY({ + x: "culmen_length_mm", + symbol: (d) => (d.sex === "FEMALE" ? "square" : "star"), + tip: true + }) + ) + ] + }); +} diff --git a/test/plots/index.ts b/test/plots/index.ts index f54398dca7..6db12dcd86 100644 --- a/test/plots/index.ts +++ b/test/plots/index.ts @@ -89,6 +89,7 @@ export * from "./empty-x.js"; export * from "./empty.js"; export * from "./energy-production.js"; export * from "./error-bar.js"; +export * from "./explicit-symbol.js"; export * from "./facet-reindex.js"; export * from "./faithful-density-1d.js"; export * from "./faithful-density.js";