Skip to content

Commit bdd9208

Browse files
committed
feat: introduce VennChart
1 parent 120f212 commit bdd9208

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed

.github/workflows/auto-release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "auto-release"
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
tagged-release:
10+
name: "Tagged Release"
11+
runs-on: "ubuntu-latest"
12+
13+
steps:
14+
- uses: "marvinpinto/action-automatic-releases@latest"
15+
with:
16+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
17+
prerelease: false

__tests__/plots/venn.spec.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { mount } from '@vue/test-utils'
2+
import VennChart from '../../src/plots/venn'
3+
4+
const config = {
5+
data: [
6+
{ sets: ['A'], size: 12, label: 'A' },
7+
{ sets: ['B'], size: 12, label: 'B' },
8+
{ sets: ['C'], size: 12, label: 'C' },
9+
{ sets: ['A', 'B'], size: 2, label: 'A&B' },
10+
{ sets: ['A', 'C'], size: 2, label: 'A&C' },
11+
{ sets: ['B', 'C'], size: 2, label: 'B&C' },
12+
{ sets: ['A', 'B', 'C'], size: 1 },
13+
],
14+
setsField: 'sets',
15+
sizeField: 'size',
16+
pointStyle: { fillOpacity: 0.85 },
17+
}
18+
19+
describe('VennChart', () => {
20+
test('should render without crashed', () => {
21+
mount(() => <VennChart {...config} />)
22+
})
23+
})

src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ import { FacetChartProps as _FacetChartProps } from './plots/facet'
5151

5252
import { CirclePackingChartProps as _CirclePackingChartProps } from './plots/circle-packing'
5353

54+
import { VennChartProps as _VennChartProps } from './plots/venn'
55+
5456
export { default as AreaChart } from './plots/area'
5557
export type AreaChartProps = _AreaChartProps
5658

@@ -141,3 +143,5 @@ export { default as FacetChart } from './plots/facet'
141143
export type FacetChartProps = _FacetChartProps
142144
export { default as CirclePackingChart } from './plots/circle-packing'
143145
export type CirclePackingChartProps = _CirclePackingChartProps
146+
export { default as VennChart } from './plots/venn'
147+
export type VennChartProps = _VennChartProps

src/plots/venn/index.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { App, defineComponent } from 'vue-demi'
2+
import { Venn, VennOptions } from '@antv/g2plot'
3+
import BaseChart, { BaseChartProps } from '../../components/base'
4+
import { Writeable } from '../../types'
5+
import { mergeAttrs } from '../../utils'
6+
7+
export type VennChartProps = Writeable<
8+
Omit<BaseChartProps<VennOptions>, 'chart' | 'data'> & VennOptions
9+
>
10+
11+
const VennChart = defineComponent<VennChartProps>({
12+
name: 'VennChart',
13+
setup(props, ctx) {
14+
return () => <BaseChart chart={Venn} {...mergeAttrs(props, ctx.attrs)} />
15+
},
16+
})
17+
18+
/* istanbul ignore next */
19+
VennChart.install = (app: App) => {
20+
app.component(VennChart.name, VennChart)
21+
}
22+
23+
export default VennChart

0 commit comments

Comments
 (0)