@atana/g2plot
v1.0.3
Published
G2Plot for React
Readme
@opd/g2plot-react
G2Plot for React
Install
npm install @opd/g2plot-reactUsage
import React, { useCallback } from 'react'
import { LineChart } from '@opd/g2plot-react'
import { LineConfig } from '@antv/g2plot'
const config: LineConfig = {
height: 400,
title: {
visible: true,
text: '配置折线数据点样式',
},
description: {
visible: true,
text: '自定义配置趋势线上数据点的样式',
},
padding: 'auto',
forceFit: true,
xField: 'year',
yField: 'value',
label: {
visible: true,
type: 'point',
},
point: {
visible: true,
size: 5,
},
xAxis: {
tickCount: 10,
},
data: [
{ year: '1991', value: 3 },
{ year: '1992', value: 4 },
{ year: '1993', value: 3.5 },
{ year: '1994', value: 5 },
{ year: '1995', value: 4.9 },
{ year: '1996', value: 6 },
{ year: '1997', value: 7 },
{ year: '1998', value: 9 },
{ year: '1999', value: 11 },
],
}
export default () => {
const handleChartMount = useCallback(chart => {
console.log(chart)
}, [])
return <LineChart {...config} onMount={handleChartMount} />
}API
All config defined in G2Plot document can be used as props
Extra Props:
onMount:(chart: Plot) => void. triggered after chart render
Support Chart
- [x]
LineChart - [x]
StepLineChart - [x]
ScatterChart - [x]
ColumnChart - [x]
HistogramChart - [x]
StackedColumnChart - [x]
RangeColumnChart - [x]
PercentStackedColumnChart - [x]
GroupedColumnChart - [x]
WaterfallChart - [x]
BarChart - [x]
StackedBarChart - [x]
RangeBarChart - [x]
PercentStackedBarChart - [x]
GroupedBarChart - [x]
AreaChart - [x]
DensityChart - [x]
StackedAreaChart - [x]
PercentStackedAreaChart - [x]
BubbleChart - [x]
PieChart - [x]
RingChart - [x]
RadarChart - [x]
GaugeChart - [x]
HeatmapChart - [x]
ProgressChart - [x]
RingProgressChart - [x]
TinyLineChart - [x]
TinyAreaChart - [x]
TinyColumnChart - [x]
FunnelChart - [x]
LiquidChart - [x]
OverlappedComboChart - [x]
RoseChart - [x]
WordCloudChart - [x]
BulletChart - [x]
TreemapChart - [x]
CalendarChart - [x]
DonutChart - [x]
StackedRoseChart - [x]
GroupedRoseChart
Develop
npm install
npm run build