Skip to content

Commit c7adfc1

Browse files
committed
feat: add MultiViewChart
1 parent dc4b5a8 commit c7adfc1

File tree

5 files changed

+42
-4
lines changed

5 files changed

+42
-4
lines changed

.eslintrc.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ module.exports = {
66
extends: [
77
'plugin:vue/vue3-strongly-recommended',
88
'standard',
9+
'prettier',
910
'plugin:prettier/recommended',
10-
'prettier/vue',
11-
'prettier/@typescript-eslint',
1211
'plugin:@typescript-eslint/recommended',
13-
'prettier/@typescript-eslint',
1412
],
1513
plugins: ['prettier', '@typescript-eslint'],
1614
parser: 'vue-eslint-parser',

__tests__/plots/multi-view.spec.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { mount } from '@vue/test-utils'
2+
import MultiViewChart from '../../src/plots/multi-view'
3+
4+
const config = {
5+
data: [],
6+
xField: 'a',
7+
yField: 'b',
8+
}
9+
10+
describe('MultiViewChart', () => {
11+
test('should render without crashed', () => {
12+
mount(() => <MultiViewChart {...config} />)
13+
})
14+
})

src/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ import { SankeyChartProps as _SankeyChartProps } from './plots/sankey'
4141

4242
import { ChordChartProps as _ChordChartProps } from './plots/chord'
4343

44+
import { MultiViewChartProps as _MultiViewChartProps } from './plots/multi-view'
45+
4446
export { default as AreaChart } from './plots/area'
4547
export type AreaChartProps = _AreaChartProps
4648

@@ -121,3 +123,5 @@ export { default as SankeyChart } from './plots/sankey'
121123
export type SankeyChartProps = _SankeyChartProps
122124
export { default as ChordChart } from './plots/chord'
123125
export type ChordChartProps = _ChordChartProps
126+
export { default as MultiViewChart } from './plots/multi-view'
127+
export type MultiViewChartProps = _MultiViewChartProps

src/plots/multi-view/index.tsx

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

tsconfig.sync.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// "sourceMap": true, /* Generates corresponding '.map' file. */
1616
// "outFile": "./", /* Concatenate and emit output to single file. */
1717
// "outDir": "./lib" /* Redirect output structure to the directory. */,
18-
"rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
18+
"rootDir": "." /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
1919
// "composite": true, /* Enable project compilation */
2020
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
2121
// "removeComments": true, /* Do not emit comments to output. */

0 commit comments

Comments
 (0)