From c91e0553bbebcab5fec7a343252b5c6de027d3e3 Mon Sep 17 00:00:00 2001 From: Colin Megill Date: Mon, 6 Nov 2017 14:33:58 -0800 Subject: [PATCH] import modularized files in continuous --- src/components/continuous/continuous.js | 56 +++++++++++++++++++++---- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/src/components/continuous/continuous.js b/src/components/continuous/continuous.js index 80e06b2e..d3fbe340 100644 --- a/src/components/continuous/continuous.js +++ b/src/components/continuous/continuous.js @@ -2,6 +2,8 @@ import React from 'react'; import _ from "lodash"; // import cells from "../../../data/GBM_metadata.js"; import drawParallelCoordinates from "./drawParallelCoordinates"; +import drawAxes from "./drawAxes"; +import setupParallelCoordinates from "./setupParallelCoordinates"; import styles from './parallelCoordinates.css'; import SectionHeader from "../framework/sectionHeader"; import { connect } from "react-redux"; @@ -9,7 +11,13 @@ import { connect } from "react-redux"; import { margin, width, - height + height, + innerHeight, + color, + createDimensions, + types, + xscale, + yAxis, } from "./util"; @connect((state) => { @@ -19,7 +27,7 @@ import { return { ranges, - metadata + metadata, } }) class Continuous extends React.Component { @@ -27,19 +35,52 @@ class Continuous extends React.Component { constructor(props) { super(props); this.state = { + svg: null, ctx: null, - parallelExists: false + axes: null, + parallelExists: false, + dimensions: null, }; } componentDidMount() { - + const {svg, ctx} = setupParallelCoordinates( + width, + height, + margin + ); + this.setState({svg, ctx}) } componentWillReceiveProps(nextProps) { - if (nextProps.ranges && !this.state.parallelExists) { - drawParallelCoordinates(nextProps.metadata, nextProps.ranges) - this.setState({parallelExists: true}) + + + + + if ( + nextProps.ranges && + !this.state.parallelExists + ) { + const dimensions = createDimensions(nextProps.ranges); + const axes = drawAxes( + this.state.svg, + dimensions, + xscale + ) + drawParallelCoordinates( + nextProps.metadata, + dimensions, + this.state.ctx, + xscale, + width, + height, + margin + ) + this.setState({ + parallelExists: true, + dimensions, + axes, + }) } } @@ -64,6 +105,7 @@ export default Continuous; /* text appended to parellel coords giving N instances of selection */ //

+// var output = d3.select("#parcoords_output");
 
 /*