wc-g2
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

wc-g2

2Kb library Web Component for G2.

Build Status npm Version npm Download npm License

Usage

  • Import the Web Component library.
import 'wc-g2';
  • Use the component wc-g2 with spec.
<wc-g2 id="my-chart"></wc-g2>

Set the options of G2.

const chart = document.getElementById('my-chart');

chart.options = {
  type: 'interval',
  data: [
    { genre: 'Sports', sold: 0 },
    { genre: 'Strategy', sold: 115 },
    { genre: 'Action', sold: 120 },
    { genre: 'Shooter', sold: 350 },
    { genre: 'Other', sold: 150 },
  ],
  encode: { x: 'genre', y: 'sold', color: 'genre' },
  style: { minHeight: 50 },
};

How to get the G2 options/spec? see G2 Spec API.

License

MIT@hustcc.

Package Sidebar

Install

npm i wc-g2

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

21.2 kB

Total Files

25

Last publish

Collaborators

  • atool