diff --git a/README.md b/README.md index 1ce5336..77a8dbf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # @strawberry-vis/g2-rect -A lightweight React Component for @antv/g2. +The lightweight React Component for [@antv/g2](https://github.com/antvis/G2). ## Installing @@ -9,13 +9,13 @@ npm install @strawberry-vis/g2-rect ``` ```jsx -import React, { useState } from "react"; +import React from "react"; import { Chart } from "@strawberry-vis/g2-rect"; export function Card() { return ( # props.**options** +| Property | Description | Type | Default | +| -------- | ------------------------------------------------------- | --------------- | ------- | +| spec | spec for visualization , say `chart.options(spec)` | `G2Spec` | - | +| options | options for instantiating char, say `G2.Chart(options)` | `ChartOptions` | - | +| style | style of the container | `CSSProperties` | - | +| onInit | callback called after the chart instantiating | `Function` | - | +| ref | ref for chart instance | `ChartRef` | - | + +## Examples + +There are some basic examples where you can get started. + +### Create Chart + +### Update Data ```js import React, { useState } from "react"; @@ -53,7 +67,10 @@ export function Card() { }); function onClick() { - setOptions({ ...options, data: options.data.slice(0, 2) }); + setOptions({ + ...options, + data: options.data.slice(0, 2), + }); } return ( @@ -65,7 +82,7 @@ export function Card() { } ``` -# props.**chartRef** +### Listen Events ```js import React, { useRef, useEffect } from "react"; @@ -82,3 +99,7 @@ export function Card() { return ; } ``` + +### Emit Events + +### Style Container diff --git a/src/index.ts b/src/index.ts index 0b4742b..04554ea 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1 @@ -export { Chart, type ChartProps, type ChartRef } from "./Chart"; \ No newline at end of file +export { Chart, type ChartProps, type ChartRef } from "./Chart";