mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-22 03:28:12 +08:00
Fixes the build error in the old version. Reverted the API version since we changed directions from updating the API to refactoring the server structure instead.
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
// jshint esversion: 6
|
|
import styles from "./graph.css";
|
|
import _ from "lodash";
|
|
import * as globals from "../../globals";
|
|
|
|
/******************************************
|
|
*******************************************
|
|
put svg & brush in DOM
|
|
*******************************************
|
|
******************************************/
|
|
|
|
export const setupSVGandBrushElements = (
|
|
handleBrushSelectAction,
|
|
handleBrushDeselectAction,
|
|
responsive,
|
|
graphPaddingTop
|
|
) => {
|
|
const side = responsive.height - graphPaddingTop;
|
|
const svg = d3
|
|
.select("#graphAttachPoint")
|
|
.append("svg")
|
|
.attr("width", side)
|
|
.attr("height", side)
|
|
.attr("class", `${styles.graphSVG}`);
|
|
|
|
const brush = d3
|
|
.brush()
|
|
.extent([
|
|
[0, 0],
|
|
[responsive.height - graphPaddingTop, responsive.height - graphPaddingTop]
|
|
])
|
|
.on("brush", handleBrushSelectAction)
|
|
.on("end", handleBrushDeselectAction);
|
|
|
|
const brushContainer = svg
|
|
.append("g")
|
|
.attr("class", "graph_brush")
|
|
.call(brush);
|
|
|
|
return {
|
|
svg,
|
|
brushContainer,
|
|
brush
|
|
};
|
|
};
|