antvis/G6

V5 Quick start demo example doesn't work #5705

xnd1124 posted onGitHub

Describe the bug

Result of rendering HTML file from demo example doesn't render graph

Your Example Website or App

https://g6-next.antv.antgroup.com/en/manual/tutorial/quick-start

Steps to Reproduce the Bug or Issue

  1. Go to https://g6-next.antv.antgroup.com/en/manual/tutorial/quick-start
  2. Copy code from "G6 in vanilla HTML" in empty HTML file
  3. Replace "https://gw.alipayobjects.com/os/lib/antv/g6/5.0.0-beta.28/dist/g6.min.js" on "https://gw.alipayobjects.com/os/lib/antv/g6/5.0.0-beta.35/dist/g6.min.js"
  4. Open HTML file in browser There is error "Graph is not defined image

Ok. 5.Replace "new Graph" on "new G6.Graph" 6. Reopen HTML file in browser No errors, but no result image

Expected behavior

As a user, I expect a rendered page with a graph

Screenshots or Videos

No response

Platform

  • OS: Windows 10
  • Browser: Chrome 124.0.6367.119
  • Version: 5.0.0-beta.35

Additional context

No response


The current official website provides incorrect examples, so please do not refer to the sample code provided there. We will prioritize updating the documentation and examples as soon as possible within this week. Thank you for your understanding and patience.

After the beta.28 version, G6 underwent a significant change. You can now use it in the following way:

import { Graph } from '@antv/g6';

const graph = new Graph({
  container: 'container',
  width: 400,
  height: 400,
  data: {
    nodes: [{ id: 'node-1' }, { id: 'node-2' }],
    edges: [{ source: 'node-1', target: 'node-2' }],
  },
  behaviors: ['zoom-canvas', 'drag-canvas', 'drag-element'],
  layout: {
    type: 'grid',
  },
});

graph.render();
posted by Aarebecca 12 months ago

Here is an online demo of CodeSandbox that you can refer to.

posted by Aarebecca 12 months ago

Thank you for the example, will wait for the documentation update

posted by xnd1124 12 months ago

Fund this Issue

$0.00
Funded

Pull requests