Skip to content

Commit 3eb78cc

Browse files
committed
test: add test case
1 parent 6cc5441 commit 3eb78cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+799
-5
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: '[Bug]'
5+
labels: bug
6+
assignees: kagawagao
7+
---
8+
9+
**Describe the bug**
10+
A clear and concise description of what the bug is.
11+
12+
**To Reproduce**
13+
Steps to reproduce the behavior:
14+
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem or a mini showcase.
25+
26+
**Desktop (please complete the following information):**
27+
28+
- OS: [e.g. iOS]
29+
- Browser [e.g. chrome, safari]
30+
- Version [e.g. 22]
31+
32+
**Additional context**
33+
Add any other context about the problem here.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: '[Feature]'
5+
labels: feature
6+
assignees: kagawagao
7+
---
8+
9+
**Is your feature request related to a problem? Please describe.**
10+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11+
12+
**Describe the solution you'd like**
13+
A clear and concise description of what you want to happen.
14+
15+
**Describe alternatives you've considered**
16+
A clear and concise description of any alternative solutions or features you've considered.
17+
18+
**Additional context**
19+
Add any other context or screenshots about the feature request here.

.github/workflows/build.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v1
11+
- name: Use Node.js
12+
uses: actions/setup-node@v1.1.0
13+
- name: npm install, test and build
14+
run: |
15+
npm ci
16+
npm run build
17+
- name: Codecov
18+
uses: codecov/codecov-action@v1.0.5
19+
with:
20+
# Repository upload token - get it from codecov.io
21+
token: ed035cb6-7365-4316-8c33-c4af92efbbb5
22+
23+
env:
24+
CI: true

README.md

Lines changed: 116 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,116 @@
1-
# g2plot-vue
2-
g2plot for vue
1+
# @opd/g2plot-vue
2+
3+
> [G2Plot](https://g2plot.antv.vision/) for React
4+
5+
[![build](https://github.com/open-data-plan/g2plot-vue/workflows/build/badge.svg)](https://github.com/open-data-plan/g2plot-vue/actions?query=workflow%3Abuild)
6+
[![npm](https://img.shields.io/npm/v/@opd/g2plot-vue.svg)](https://www.npmjs.com/package/@opd/g2plot-vue)
7+
[![npm](https://img.shields.io/npm/dm/@opd/g2plot-vue.svg)](https://www.npmjs.com/package/@opd/g2plot-vue)
8+
[![npm](https://img.shields.io/npm/l/@opd/g2plot-vue.svg)](https://www.npmjs.com/package/@opd/g2plot-vue)
9+
[![codecov](https://codecov.io/gh/open-data-plan/g2plot-vue/branch/master/graph/badge.svg)](https://codecov.io/gh/open-data-plan/g2plot-vue)
10+
11+
## Install
12+
13+
```
14+
npm install @opd/g2plot-vue
15+
```
16+
17+
## Usage
18+
19+
```tsx
20+
import { LineChart, LineChartProps } from '@opd/g2plot-vue'
21+
22+
const 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,
34+
xField: 'year',
35+
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,
46+
},
47+
data: [
48+
{ year: '1991', value: 3 },
49+
{ year: '1992', value: 4 },
50+
{ year: '1993', value: 3.5 },
51+
{ year: '1994', value: 5 },
52+
{ year: '1995', value: 4.9 },
53+
{ year: '1996', value: 6 },
54+
{ year: '1997', value: 7 },
55+
{ year: '1998', value: 9 },
56+
{ year: '1999', value: 11 },
57+
],
58+
}
59+
60+
export default () => {
61+
return <LineChart {...config} />
62+
}
63+
```
64+
65+
## API
66+
67+
All config defined in `G2Plot` [document](https://g2plot.antv.vision/zh/docs/manual/introduction) can be used as `props` or `attrs`
68+
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+
111+
## Develop
112+
113+
```
114+
npm install
115+
npm run build
116+
```

__tests__/plots/bar.spec.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { mount } from '@vue/test-utils'
2+
import BarChart from '../../src/plots/bar'
3+
4+
describe('BarChart', () => {
5+
test('should render without crashed', () => {
6+
mount(BarChart, {
7+
props: {
8+
data: [],
9+
xField: 'a',
10+
yField: 'b',
11+
},
12+
})
13+
})
14+
})

__tests__/plots/bubble.spec.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { mount } from '@vue/test-utils'
2+
import BubbleChart from '../../src/plots/bubble'
3+
4+
describe('BubbleChart', () => {
5+
test('should render without crashed', () => {
6+
mount(BubbleChart, {
7+
props: {
8+
data: [],
9+
xField: 'a',
10+
yField: 'b',
11+
},
12+
})
13+
})
14+
})

__tests__/plots/bullet.spec.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { mount } from '@vue/test-utils'
2+
import BulletChart from '../../src/plots/bullet'
3+
4+
describe('BulletChart', () => {
5+
test('should render without crashed', () => {
6+
mount(BulletChart, {
7+
props: {},
8+
})
9+
})
10+
})

__tests__/plots/calendar.spec.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { mount } from '@vue/test-utils'
2+
import CalendarChart from '../../src/plots/calendar'
3+
4+
describe('CalendarChart', () => {
5+
test('should render without crashed', () => {
6+
mount((props, ctx) => <CalendarChart {...props} {...ctx.attrs} />, {
7+
props: {
8+
data: [],
9+
dateField: 'date',
10+
valueField: 'commits',
11+
dateRange: ['2017-05-01', '2017-10-31'],
12+
colors: '#BAE7FF-#1890FF-#0050B3',
13+
},
14+
})
15+
})
16+
})
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { mount } from '@vue/test-utils'
2+
import Chart from '../../src/plots/column-line'
3+
4+
describe('Chart', () => {
5+
test('should render without crashed', () => {
6+
mount(Chart, {
7+
props: {},
8+
})
9+
})
10+
})

__tests__/plots/column.spec.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { mount } from '@vue/test-utils'
2+
import Chart from '../../src/plots/column'
3+
4+
describe('Chart', () => {
5+
test('should render without crashed', () => {
6+
mount(Chart, {
7+
props: {},
8+
})
9+
})
10+
})

0 commit comments

Comments
 (0)