@@ -16,33 +16,22 @@ npm install @opd/g2plot-vue
1616
1717## Usage
1818
19+ ### jsx
20+
1921``` tsx
22+ import { defineComponent , ref } from ' vue'
2023import { LineChart , LineChartProps } from ' @opd/g2plot-vue'
2124
2225const config: LineChartProps = {
23- height: 400 ,
24- title: {
25- visible: true ,
26- text: ' 配置折线数据点样式' ,
27- },
28- description: {
29- visible: true ,
30- text: ' 自定义配置趋势线上数据点的样式' ,
31- },
32- padding: ' auto' ,
33- forceFit: true ,
26+ height: 350 ,
27+ autoFit: true ,
3428 xField: ' year' ,
3529 yField: ' value' ,
36- label: {
37- visible: true ,
38- type: ' point' ,
39- },
40- point: {
41- visible: true ,
42- size: 5 ,
43- },
44- xAxis: {
45- tickCount: 10 ,
30+ smooth: true ,
31+ meta: {
32+ value: {
33+ max: 15 ,
34+ },
4635 },
4736 data: [
4837 { year: ' 1991' , value: 3 },
@@ -57,57 +46,60 @@ const config: LineChartProps = {
5746 ],
5847}
5948
60- export default () => {
61- return <LineChart { ... config } />
49+ export default defineComponent (() => {
50+ const chartRef = ref (null )
51+ return <LineChart { ... config } chartRef = { chartRef } />
52+ })
53+ ```
54+
55+ ### template
56+
57+ ``` vue
58+ <template>
59+ <line-chart v-bind="config" />
60+ </template>
61+ <script>
62+ import Vue from 'vue'
63+ import { LineChart } from '@opd/g2plot-vue'
64+
65+ Vue.use(LineChart)
66+
67+ export default {
68+ data() {
69+ return {
70+ config: {
71+ height: 350,
72+ autoFit: true,
73+ xField: 'year',
74+ yField: 'value',
75+ smooth: true,
76+ meta: {
77+ value: {
78+ max: 15,
79+ },
80+ },
81+ data: [
82+ { year: '1991', value: 3 },
83+ { year: '1992', value: 4 },
84+ { year: '1993', value: 3.5 },
85+ { year: '1994', value: 5 },
86+ { year: '1995', value: 4.9 },
87+ { year: '1996', value: 6 },
88+ { year: '1997', value: 7 },
89+ { year: '1998', value: 9 },
90+ { year: '1999', value: 11 },
91+ ],
92+ },
93+ }
94+ },
6295}
96+ </script>
6397```
6498
6599## API
66100
67101All config defined in ` G2Plot ` [ document] ( https://g2plot.antv.vision/zh/docs/manual/introduction ) can be used as ` props ` or ` attrs `
68102
69- ## Support Chart
70-
71- - [x] [ ` LineChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/line )
72- - [x] [ ` StepLineChart ` ] ( https://g2plot.antv.vision/zh/examples/step-line/multiple )
73- - [x] [ ` ScatterChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/scatter )
74- - [x] [ ` ColumnChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/column )
75- - [x] [ ` HistogramChart ` ] ( https://g2plot.antv.vision/zh/examples/column/histogram )
76- - [x] [ ` StackedColumnChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/stacked-column )
77- - [x] [ ` RangeColumnChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/range-column )
78- - [x] [ ` PercentStackedColumnChart ` ] ( https://g2plot.antv.vision/zh/examples/column/percent-stacked )
79- - [x] [ ` GroupedColumnChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/grouped-column )
80- - [x] [ ` WaterfallChart ` ] ( https://g2plot.antv.vision/zh/examples/column/waterfall )
81- - [x] [ ` BarChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/bar )
82- - [x] [ ` StackedBarChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/stacked-bar )
83- - [x] [ ` RangeBarChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/range-bar )
84- - [x] [ ` PercentStackedBarChart ` ] ( https://g2plot.antv.vision/zh/examples/bar/percent-stacked )
85- - [x] [ ` GroupedBarChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/grouped-bar )
86- - [x] [ ` AreaChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/area )
87- - [x] [ ` DensityChart ` ] ( https://github.com/antvis/G2Plot/blob/master/src/plots/density/index.ts )
88- - [x] [ ` StackedAreaChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/stacked-area )
89- - [x] [ ` PercentStackedAreaChart ` ] ( https://g2plot.antv.vision/zh/examples/area/percent-stacked )
90- - [x] [ ` BubbleChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/bubble )
91- - [x] [ ` PieChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/pie )
92- - [x] [ ` RadarChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/radar )
93- - [x] [ ` GaugeChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/gauge )
94- - [x] [ ` HeatmapChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/heatmap )
95- - [x] [ ` ProgressChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/sparkline-progress )
96- - [x] [ ` RingProgressChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/sparkline-ring-progress )
97- - [x] [ ` TinyLineChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/sparkline-line )
98- - [x] [ ` TinyAreaChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/sparkline-area )
99- - [x] [ ` TinyColumnChart ` ] ( https://g2plot.antv.vision/zh/docs/manual/plots/sparkline-column )
100- - [x] [ ` FunnelChart ` ] ( https://g2plot.antv.vision/zh/examples/funnel/basic )
101- - [x] [ ` LiquidChart ` ] ( https://g2plot.antv.vision/zh/examples/liquid/basic )
102- - [x] [ ` RoseChart ` ] ( https://g2plot.antv.vision/zh/examples/rose/basic )
103- - [x] [ ` WordCloudChart ` ] ( https://g2plot.antv.vision/zh/examples/word-cloud/basic )
104- - [x] [ ` BulletChart ` ] ( https://g2plot.antv.vision/zh/examples/bullet/basic )
105- - [x] [ ` TreemapChart ` ] ( https://g2plot.antv.vision/zh/examples/treemap/rect )
106- - [x] [ ` CalendarChart ` ] ( https://g2plot.antv.vision/zh/examples/calendar/basic )
107- - [x] [ ` DonutChart ` ] ( https://g2plot.antv.vision/zh/examples/pie/donut )
108- - [x] [ ` StackedRoseChart ` ] ( https://g2plot.antv.vision/zh/examples/rose/rose#stacked-rose )
109- - [x] [ ` GroupedRoseChart ` ] ( https://g2plot.antv.vision/zh/examples/rose/rose#grouped-rose )
110-
111103## Develop
112104
113105```
0 commit comments