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

V5 Quick start demo example doesn't work #5705

Closed
xnd1124 opened this issue May 7, 2024 · 3 comments
Closed

V5 Quick start demo example doesn't work #5705

xnd1124 opened this issue May 7, 2024 · 3 comments

Comments

@xnd1124
Copy link

xnd1124 commented May 7, 2024

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

@xnd1124 xnd1124 changed the title V5 Quick start demo example example doesn't work V5 Quick start demo example doesn't work May 7, 2024
@Aarebecca
Copy link
Contributor

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();

@Aarebecca
Copy link
Contributor

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

@xnd1124
Copy link
Author

xnd1124 commented May 7, 2024

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

@xnd1124 xnd1124 closed this as completed May 7, 2024
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

2 participants