mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-06 21:58:12 +08:00
import modularized files in continuous
This commit is contained in:
@@ -2,6 +2,8 @@ import React from 'react';
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
// import cells from "../../../data/GBM_metadata.js";
|
// import cells from "../../../data/GBM_metadata.js";
|
||||||
import drawParallelCoordinates from "./drawParallelCoordinates";
|
import drawParallelCoordinates from "./drawParallelCoordinates";
|
||||||
|
import drawAxes from "./drawAxes";
|
||||||
|
import setupParallelCoordinates from "./setupParallelCoordinates";
|
||||||
import styles from './parallelCoordinates.css';
|
import styles from './parallelCoordinates.css';
|
||||||
import SectionHeader from "../framework/sectionHeader";
|
import SectionHeader from "../framework/sectionHeader";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -9,7 +11,13 @@ import { connect } from "react-redux";
|
|||||||
import {
|
import {
|
||||||
margin,
|
margin,
|
||||||
width,
|
width,
|
||||||
height
|
height,
|
||||||
|
innerHeight,
|
||||||
|
color,
|
||||||
|
createDimensions,
|
||||||
|
types,
|
||||||
|
xscale,
|
||||||
|
yAxis,
|
||||||
} from "./util";
|
} from "./util";
|
||||||
|
|
||||||
@connect((state) => {
|
@connect((state) => {
|
||||||
@@ -19,7 +27,7 @@ import {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
ranges,
|
ranges,
|
||||||
metadata
|
metadata,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
class Continuous extends React.Component {
|
class Continuous extends React.Component {
|
||||||
@@ -27,19 +35,52 @@ class Continuous extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
|
svg: null,
|
||||||
ctx: null,
|
ctx: null,
|
||||||
parallelExists: false
|
axes: null,
|
||||||
|
parallelExists: false,
|
||||||
|
dimensions: null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const {svg, ctx} = setupParallelCoordinates(
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
margin
|
||||||
|
);
|
||||||
|
this.setState({svg, ctx})
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
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 */
|
/* text appended to parellel coords giving N instances of selection */
|
||||||
// <pre id="parcoords_output" className={styles.pre}></pre>
|
// <pre id="parcoords_output" className={styles.pre}></pre>
|
||||||
|
// var output = d3.select("#parcoords_output");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user