Skip to content

Commit 431edde

Browse files
committed
remove duplicates from channel-derived domain
1 parent 46a3cdd commit 431edde

File tree

4 files changed

+2240
-3
lines changed

4 files changed

+2240
-3
lines changed

src/channel.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {ascending, descending, rollup, sort} from "d3";
1+
import {ascending, descending, InternSet, rollup, sort} from "d3";
22
import {first, isColor, isEvery, isIterable, labelof, map, maybeValue, range, valueof} from "./options.js";
33
import {registry} from "./scales/index.js";
44
import {isSymbol, maybeSymbol} from "./symbols.js";
@@ -82,8 +82,8 @@ export function channelDomain(channels, facetChannels, data, options) {
8282
const [lo = 0, hi = Infinity] = isIterable(limit) ? limit : limit < 0 ? [limit] : [0, limit];
8383
if (y == null) {
8484
X.domain = () => {
85-
let domain = XV;
86-
if (reverse) domain = domain.slice().reverse();
85+
let domain = Array.from(new InternSet(XV)); // remove any duplicates
86+
if (reverse) domain = domain.reverse();
8787
if (lo !== 0 || hi !== Infinity) domain = domain.slice(lo, hi);
8888
return domain;
8989
};

0 commit comments

Comments
 (0)