ChrisShen93 / VGEditor

A visual graph editor based on G6 and Vue, inspired by GGEditor.
https://chrisshen93.github.io/VGEditor
MIT License
211 stars 47 forks source link

How to load remote data? #23

Open trusovandrey1 opened 4 years ago

trusovandrey1 commented 4 years ago

Please advise how do I receive and render remote data?

G6 docs has example, but I don't know for sure how to correlate it with you editor? - https://g6.antv.vision/en/docs/manual/tutorial/example

That what I have, it loads data, but doesn't render.

<flow :data="mockData" :graph="customGraphConfig" :onNodeDoubleClick="showModalLocation" :onAfterChange="saveDataFromChart" />

data () { return { mockData: this.fetchData(), customGraphConfig: { layout: { type: 'radial', unitRadius: 50, center: [500, 300], }, grid: { number: 33, } } }

async fetchData () { const response = await fetch("https://api.npoint.io/2f71ed8920af3f07cd05"); const data = await response.json(); let mData = data; console.log(mData) return mData } },

trusovandrey1 commented 4 years ago

Did this with (this.$refs.flowChart.propsAPI.read())