drawing graph

This commit is contained in:
Colin Megill
2017-09-08 01:08:01 -07:00
parent 0e36aaf830
commit b6be4947eb
6 changed files with 155 additions and 201 deletions
+10 -13
View File
@@ -1,34 +1,31 @@
import React from 'react';
import _ from "lodash";
// import styles from "./joy.css";
// import drawGraph from "./drawGraph";
// import joyParser from "./joyParser";
import styles from "./graph.css";
import drawGraph from "./drawGraph";
class Graph extends React.Component {
constructor(props) {
super(props);
this.state = {
drawn: false,
};
}
componentWillReceiveProps(nextProps) {
if (nextProps.data) {
console.log('graph data 55', nextProps.data)
// drawGraph(graphParser(nextProps.data));
/* maybe should do a check here to confirm ref exists and pass it? */
if (nextProps.data && !this.state.drawn) {
console.log('About to draw graph. Data:', nextProps.data)
drawGraph(nextProps.data.data)
this.setState({drawn: true});
}
}
componentDidMount() {
}
render() {
return (
<div id="joyplot_wrapper" style={{marginTop: 50}}>
<div id="graphWrapper">
<h3> Graph </h3>
<div id="joyplot"> </div>
<div id="graphAttachPoint"> </div>
</div>
)
}