@opendata-ai/openchart-engine 7.4.0 → 7.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/legend.test.ts +54 -0
- package/src/legend/compute.ts +9 -1
package/dist/index.js
CHANGED
|
@@ -9656,7 +9656,11 @@ function extractColorEntries(spec, theme) {
|
|
|
9656
9656
|
if (!colorEnc) return [];
|
|
9657
9657
|
if ("condition" in colorEnc) return [];
|
|
9658
9658
|
if (colorEnc.type === "quantitative") return [];
|
|
9659
|
-
const dataValues = [
|
|
9659
|
+
const dataValues = [
|
|
9660
|
+
...new Set(
|
|
9661
|
+
spec.data.filter((d) => d[colorEnc.field] != null).map((d) => String(d[colorEnc.field]))
|
|
9662
|
+
)
|
|
9663
|
+
];
|
|
9660
9664
|
const explicitDomain = colorEnc.scale?.domain;
|
|
9661
9665
|
const explicitRange = colorEnc.scale?.range;
|
|
9662
9666
|
const palette = explicitRange ?? theme.colors.categorical;
|