Files
cellxgene/client/src/components/graph/setupSVGandBrush.js
T
Colin Megill dbff824854 Viewport fills entire screen (#430)
* full pane webgl and svg

* fixes for full pane selection and centering

* force graph remount, clear brush state
2018-11-13 11:45:38 -05:00

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
};
};