mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-27 12:18:11 +08:00
Remove d3 dependency in crossfilter (#1108)
* Remove d3 dependency in crossfilter
Fixes https://github.com/chanzuckerberg/cellxgene/issues/648
* Revert "Remove d3 dependency in crossfilter"
This reverts commit 03b478f7dc.
* Remove d3 dependency in crossfilter
Fixes https://github.com/chanzuckerberg/cellxgene/issues/648
* Fix typo in docstring
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import _ from "lodash";
|
||||
import { polygonContains } from "d3";
|
||||
|
||||
import Crossfilter from "../../../src/util/typedCrossfilter";
|
||||
|
||||
@@ -334,12 +333,17 @@ describe("ImmutableTypedCrossfilter", () => {
|
||||
);
|
||||
|
||||
test.each([
|
||||
[[[0, 0], [0, 1], [1, 1], [1, 0]]],
|
||||
[[[0, 0], [0, 0.5], [0.5, 0.5], [0.5, 0]]]
|
||||
])("within-polygon %p", polygon => {
|
||||
expect(
|
||||
p.select("coords", { mode: "within-polygon", polygon }).allSelected()
|
||||
).toEqual(_.filter(someData, d => polygonContains(polygon, d.coords)));
|
||||
[
|
||||
[[0, 0], [0, 1], [1, 1], [1, 0]],
|
||||
[true, true, true, true, true, false, true, true, true, true, true, true]
|
||||
],
|
||||
[
|
||||
[[0, 0], [0, 0.5], [0.5, 0.5], [0.5, 0]],
|
||||
[true, true, true, true, false, false, false, true, true, true, false, false]
|
||||
]
|
||||
])("within-polygon %p", (polygon, expected) => {
|
||||
expect(p.select("coords", { mode: "within-polygon", polygon }).allSelected())
|
||||
.toEqual(_.zip(someData, expected).filter(x => x[1]).map(x => x[0]));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user