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

feat: support g6 ssr #6454

Merged
merged 5 commits into from
Oct 31, 2024
Merged

feat: support g6 ssr #6454

merged 5 commits into from
Oct 31, 2024

Conversation

Aarebecca
Copy link
Contributor

@Aarebecca Aarebecca commented Oct 29, 2024

  • Canvas 支持关闭多层画布
  • 支持 SSR 渲染
    • 支持 JS API 调用
    • 支持 CLI 调用

SSR extension for G6 5.0

This extension package provides SSR support for G6 5.0, which supports canvas rendering in server side.

Usage

Install

npm install @antv/g6-ssr

Render in JavaScript API

import { createGraph } from '@antv/g6-ssr';

const graph = await createGraph({
  width: 500,
  height: 500,
  data: {
    // data
  },
  // other options
});

graph.exportToFile('image');
// -> image.png

Render in CLI

npx g6-ssr export -i [graph-options].json -o ./image

Export SVG / PDF

When render in JavaScript API, you can pass outputType option to export SVG or PDF.

const graph = await createGraph({
  width: 500,
  height: 500,
  data: {
    // data
  },
  outputType: 'svg', // or 'pdf'
  // other options
});

When render in CLI, you can pass -t or --type option to export SVG or PDF.

npx g6-ssr export -i [graph-options].json -o ./file -t pdf

License

MIT

@Aarebecca Aarebecca force-pushed the feat/ssr branch 2 times, most recently from 920914a to 81f661d Compare October 30, 2024 11:11
@Aarebecca Aarebecca changed the title refactor: canvas support disable mutiple layers feat: support g6 ssr Oct 30, 2024
@hustcc
Copy link
Member

hustcc commented Oct 30, 2024

cli 有必要加一个 export 命令参数吗?

@hustcc
Copy link
Member

hustcc commented Oct 30, 2024

g2 的也这样搞一个版本。

@Aarebecca
Copy link
Contributor Author

cli 有必要加一个 export 命令参数吗?

理论上这样会规范一些,保不准后面会有其他的命令

@Aarebecca
Copy link
Contributor Author

g2 的也这样搞一个版本。

那放到什么位置呢?antvis 下?

@hustcc
Copy link
Member

hustcc commented Oct 30, 2024

g2 的也这样搞一个版本。

那放到什么位置呢?antvis 下?

放 g2-extensions 中。

@Aarebecca Aarebecca merged commit e4ebb8d into v5 Oct 31, 2024
3 of 5 checks passed
@Aarebecca Aarebecca deleted the feat/ssr branch October 31, 2024 02:11
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

Successfully merging this pull request may close these issues.

2 participants