|
| 1 | +<template> |
| 2 | + <ejs-diagram id="diagram" :width="width" :height="height" :nodes="nodes" :getNodeDefaults="getNodeDefaults" |
| 3 | + :connectors="connectors"></ejs-diagram> |
| 4 | +</template> |
| 5 | +<script> |
| 6 | +import { DiagramComponent } from '@syncfusion/ej2-vue-diagrams'; |
| 7 | +
|
| 8 | +let nodes = [ |
| 9 | + { |
| 10 | + id: "node1", |
| 11 | + //height: 60, |
| 12 | + //width: 170, |
| 13 | + //offsetX: 600, |
| 14 | + offsetY: 50, |
| 15 | + shape: { type: "Flow", shape: "Terminator" }, |
| 16 | + annotations: [{ content: "Start" }] |
| 17 | + }, |
| 18 | + { |
| 19 | + id: "node2", |
| 20 | + offsetY: 140, |
| 21 | + shape: { type: "Flow", shape: "Process" }, |
| 22 | + annotations: [{ content: "create variable i = 0" }] |
| 23 | + }, |
| 24 | + { |
| 25 | + id: "node3", |
| 26 | + offsetY: 230, |
| 27 | + shape: { type: "Flow", shape: "Decision" }, |
| 28 | + annotations: [{ content: "is i < 10?" }] |
| 29 | + }, |
| 30 | + { |
| 31 | + id: "node4", |
| 32 | + offsetY: 340, |
| 33 | + shape: { type: "Flow", shape: "PreDefinedProcess" }, |
| 34 | + annotations: [ |
| 35 | + { |
| 36 | + content: 'print "Syncfusion!!"' |
| 37 | + } |
| 38 | + ] |
| 39 | + }, |
| 40 | + { |
| 41 | + id: "node5", |
| 42 | + offsetY: 430, |
| 43 | + shape: { type: "Flow", shape: "Process" }, |
| 44 | + annotations: [ |
| 45 | + { |
| 46 | + content: "i = i + 1" |
| 47 | + } |
| 48 | + ] |
| 49 | + }, |
| 50 | + { |
| 51 | + id: "node6", |
| 52 | + offsetY: 520, |
| 53 | + shape: { type: "Flow", shape: "Terminator" }, |
| 54 | + annotations: [{ content: "End" }] |
| 55 | + } |
| 56 | +]; |
| 57 | +
|
| 58 | +let connectors = [ |
| 59 | + { |
| 60 | + id: "connector1", |
| 61 | + sourceID: "node1", |
| 62 | + targetID: "node2" |
| 63 | + }, |
| 64 | + { |
| 65 | + id: "connector2", |
| 66 | + sourceID: "node2", |
| 67 | + targetID: "node3" |
| 68 | + }, |
| 69 | + { |
| 70 | + id: "connector3", |
| 71 | + sourceID: "node3", |
| 72 | + targetID: "node4", |
| 73 | + annotations: [{ content: "Yes", style: { fill: "white"}}] |
| 74 | + }, |
| 75 | + { |
| 76 | + id: "connector4", |
| 77 | + sourceID: "node4", |
| 78 | + targetID: "node5" |
| 79 | + }, |
| 80 | + { |
| 81 | + id: "connector5", |
| 82 | + sourceID: "node3", |
| 83 | + targetID: "node6", |
| 84 | + type: "Orthogonal", |
| 85 | + segments:[ |
| 86 | + { length: 30, direction: "Right"}, |
| 87 | + { length: 300, direction: "Bottom"} |
| 88 | + ], |
| 89 | + annotations: [{ content: "No", style: { fill: "white" } }] |
| 90 | + }, |
| 91 | + { |
| 92 | + id: "connector6", |
| 93 | + sourceID: "node5", |
| 94 | + targetID: "node3", |
| 95 | + type: "Orthogonal", |
| 96 | + segments: [ |
| 97 | + { length: 30, direction: "Left" }, |
| 98 | + { length: 200, direction: "Top" } |
| 99 | + ] |
| 100 | + } |
| 101 | +]; |
| 102 | +
|
| 103 | +export default { |
| 104 | + components: { |
| 105 | + "ejs-diagram": DiagramComponent |
| 106 | + }, |
| 107 | +
|
| 108 | + data: function () { |
| 109 | + return { |
| 110 | + width: "1250px", |
| 111 | + height: "560px", |
| 112 | + nodes: nodes, |
| 113 | + connectors: connectors, |
| 114 | + getNodeDefaults: (node) => { |
| 115 | + node.height = 60; |
| 116 | + node.width = 170; |
| 117 | + node.offsetX = 600; |
| 118 | + return node; |
| 119 | + } |
| 120 | + } |
| 121 | + } |
| 122 | +} |
| 123 | +</script> |
| 124 | +<style> |
| 125 | +@import "../node_modules/@syncfusion/ej2-vue-diagrams/styles/material.css"; |
| 126 | +</style> |
0 commit comments