https://github.com/hustcc/wc-g2
🟪 Web Components for Visualization based on G2.
https://github.com/hustcc/wc-g2
antv g2 visualization web-conponents
Last synced: 2 months ago
JSON representation
🟪 Web Components for Visualization based on G2.
- Host: GitHub
- URL: https://github.com/hustcc/wc-g2
- Owner: hustcc
- License: mit
- Created: 2023-05-06T06:10:43.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-07T10:18:56.000Z (over 1 year ago)
- Last Synced: 2025-03-12T15:51:19.326Z (2 months ago)
- Topics: antv, g2, visualization, web-conponents
- Language: TypeScript
- Homepage: https://git.hust.cc/wc-g2/
- Size: 6.84 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# wc-g2
> 2Kb library `Web Component` for [G2](https://g2.antv.antgroup.com/).
[](https://github.com/hustcc/wc-g2/actions)
[](https://www.npmjs.com/package/wc-g2)
[](https://www.npmjs.com/package/wc-g2)
[](https://www.npmjs.com/package/wc-g2)## Usage
- Import the Web Component library.
```ts
import 'wc-g2';
```- Use the component `wc-g2` with spec.
```html
```
Set the options of G2.
```js
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](https://g2.antv.antgroup.com/manual/more/experimental-spec-api).
## License
MIT@[hustcc](https://github.com/hustcc).