wc-g2
v0.1.1
Published
2Kb Web Components for G2.
Downloads
8
Maintainers
Readme
wc-g2
2Kb library
Web Component
for G2.
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.