0.1.0 • Published 5 months ago

@antv/g2-ssr v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

SSR extension for G2 5.0

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

Usage

Install

npm install @antv/g2-ssr

Render in JavaScript API

For complete options, please refer to G2 Spec

import { createChart } from '@antv/g2-ssr';

const chart = await createChart({
  width: 640,
  height: 480,
  imageType: 'png', // or 'jpeg'
  // chart spec
});

chart.exportToFile('chart');
// -> chart.png

chart.toBuffer();
// -> get buffer

Render in CLI

npx g2-ssr export -i [chart-spec].json -o ./chart

Export SVG / PDF

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

const chart = await createChart({
  width: 640,
  height: 480,
  outputType: 'svg', // or 'pdf'
  // chart spec
});

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

npx g2-ssr export -i [chart-spec].json -o ./file -t pdf

License

MIT

0.1.0

5 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

11 months ago

0.0.1

12 months ago