mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-26 18:48:11 +08:00
* full pane webgl and svg * fixes for full pane selection and centering * force graph remount, clear brush state
41 lines
972 B
JavaScript
41 lines
972 B
JavaScript
// jshint esversion: 6
|
|
import * as d3 from "d3";
|
|
import styles from "./graph.css";
|
|
|
|
/******************************************
|
|
*******************************************
|
|
put svg & brush in DOM
|
|
*******************************************
|
|
******************************************/
|
|
|
|
export default (
|
|
handleBrushSelectAction,
|
|
handleBrushDeselectAction,
|
|
responsive,
|
|
graphPaddingRight
|
|
) => {
|
|
const svg = d3
|
|
.select("#graphAttachPoint")
|
|
.append("svg")
|
|
.attr("width", responsive.width - graphPaddingRight)
|
|
.attr("height", responsive.height)
|
|
.attr("class", `${styles.graphSVG}`);
|
|
|
|
const brush = d3
|
|
.brush()
|
|
.extent([[0, 0], [responsive.width - graphPaddingRight, responsive.height]])
|
|
.on("brush", handleBrushSelectAction)
|
|
.on("end", handleBrushDeselectAction);
|
|
|
|
const brushContainer = svg
|
|
.append("g")
|
|
.attr("class", "graph_brush")
|
|
.call(brush);
|
|
|
|
return {
|
|
svg,
|
|
brushContainer,
|
|
brush
|
|
};
|
|
};
|