flowchart.js icon indicating copy to clipboard operation
flowchart.js copied to clipboard

Error: Cannot read property 'key' of null

Open gugahoi opened this issue 10 years ago • 4 comments

Trying to get the basic example to work with no luck. this is what is in the body of my page:

<div id="diagram">Diagram will be placed here</div>
<script>
  var diagram = flowchart.parse('st=>start: Start:>http://www.google.com[blank]\n' +
                                'e=>end:>http://www.google.com');
  diagram.drawSVG('diagram');
</script>

Always get the following error no matter what is inside the parse().

TypeError: Cannot read property 'key' of null
    at getDisplaySymbol (http://localhost:3000/include/plugins/flowchart/1.4.2/flowchart.js:1205:28)
    at constructChart (http://localhost:3000/include/plugins/flowchart/1.4.2/flowchart.js:1236:26)
    at Object.chart.drawSVG (http://localhost:3000/include/plugins/flowchart/1.4.2/flowchart.js:1269:11)

How do I solve this and what is the least I need to create a flowchart?

gugahoi avatar Nov 30 '15 23:11 gugahoi

你的语法有问题 在没一个动作后面加 \n

var diagram = flowchart.parse('st=>start: 伍|past:>http://www.google.com[blank]\n' +
            'e=>end: Ende:>http://www.google.com\n' +
            'op1=>operation: My Operation|past\n' +
            'op2=>operation: Stuff|current\n' +
            'sub1=>subroutine: My Subroutine|invalid\n' +
            'cond=>condition: Yes or No?|approved:>http://www.google.com\n' +
            'c2=>condition: Good idea|rejected\n' +
            'io=>inputoutput: catch something...|request\n' +
            'st->op1(right)->cond\n' +
            'cond(yes, right)->c2\n' + 
            'cond(no)->sub1(left)->op1\n');

WcombL avatar Dec 03 '15 09:12 WcombL

Sorry but I don't speak chinese. What does that mean?

gugahoi avatar Dec 03 '15 23:12 gugahoi

@gugahoi According to google translate he is saying something like the trailing \n is causing syntax errors. Hope that is pointing you in the right direction.

hacfi avatar Dec 04 '15 01:12 hacfi

Hello,

A working jsfiddle: https://jsfiddle.net/Wiickette/qLuexh6L/1/

ghost avatar Dec 22 '15 09:12 ghost