Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iteratee is not a function ? #74

Open
knightswatch3 opened this issue Apr 12, 2021 · 0 comments
Open

Iteratee is not a function ? #74

knightswatch3 opened this issue Apr 12, 2021 · 0 comments

Comments

@knightswatch3
Copy link

Here is my react component that renders the graph on the DOM.

import PropTypes from "prop-types";
import React, { Component} from "react";
import cytoscape from "cytoscape";
import dagre from "cytoscape-dagre";
import CytoscapeComponent from "react-cytoscapejs";

const _ = {
get: require("lodash/get"),
isEqual: require("lodash/isEqual")
};

          class EditNewGraph extends Component{
                constructor(props){
                    super(props);
                    this.state={
                        rendered: false
                    }
                    this.renderedGraph = this.renderGraph.bind(this);
                    this.graphInstance = null;    
                  }
          
                    UNSAFE_componentWillReceiveProps(){
                      
                  }

            componentDidMount(){
                this.setUpListeners();
                this.setState({ 
                    layout : {
                        name: 'dagre',
                        directed: true,
                        roots: '#a',
                        padding: 10,
                        animate: true
                    }
                }) 
                 
            }
                setUpListeners(){
                    console.log(this.cy); 
                    this.cy.on('click', 'node', (event)=>{
                        console.log(event.target['_private']['data']);
                    }) 
                    this.cy.on('cxttap', "node", function(event) {console.log("Right clicked"); });
                    // this.cy.animate=true;
                }
    
    
            renderGraph(){
                this.props.actions.tasks.updateGraphRenderState("pending");
                this.graphInstance.attach("TaskGraphEditor");
            }
    
            render(){
                cytoscape.use(dagre);
                const elements = [
                    { data: { id: 'one', label: 'Node 1', customData:"alfamale" } },
                    { data: { id: 'two', label: 'Node 2', customData: 'alfaFemale' } },
                    { data: { id: 'three', label: 'Node 3', customData: 'alfajigolo' }},
                    { data: { source: 'one', target: 'two', label: 'Edge from Node1 to Node2' } },
                    { data: { source: 'two', target: 'three', label: 'Edge from Node1 to Node3' } }
                 ];
                return ( 
                         <CytoscapeComponent elements={elements} style={{ width: '100vw', height : '100vh'}} cy={(cy)=>{this.cy=cy}} layout={this.state.layout}/>
                    
                )
            }
      }
    
      
    EditNewGraph.propTypes = {
        states: PropTypes.shape({
          tasks: PropTypes.object.isRequired,
          settings: PropTypes.object.isRequired
        }),
        actions: PropTypes.shape({
          global: PropTypes.object.isRequired,
          tasks: PropTypes.object.isRequired
        })
      };
      
      EditNewGraph.defaultProps = {};
      
      export default EditNewGraph;

And I am unable to figure out what is causing this error:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant