Skip to content

Commit 9f859e6

Browse files
committed
feat: add waterfall chart suport
1 parent 7425fb1 commit 9f859e6

File tree

6 files changed

+4700
-4612
lines changed

6 files changed

+4700
-4612
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`WaterfallChart should render without crashed 1`] = `<div />`;

__tests__/plots/waterfall.spec.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react'
2+
import { create } from 'react-test-renderer'
3+
import WaterfallChart from '../../src/plots/waterfall'
4+
5+
describe('WaterfallChart', () => {
6+
test('should render without crashed', () => {
7+
const renderer = create(<WaterfallChart data={[]} xField="x" yField="y" />)
8+
9+
expect(renderer.toJSON()).toMatchSnapshot()
10+
})
11+
})

package-lock.json

Lines changed: 4656 additions & 4602 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,12 @@
4747
"postversion": "npm publish"
4848
},
4949
"devDependencies": {
50-
"@antv/g2plot": "^2.0.2",
51-
"@babel/cli": "^7.11.6",
50+
"@antv/g2plot": "^2.0.3",
5251
"@commitlint/cli": "^11.0.0",
5352
"@commitlint/config-conventional": "^11.0.0",
54-
"@opd/babel-preset-component": "^1.10.0",
55-
"@opd/eslint-config-pangu": "^1.10.0",
56-
"@opd/jest-preset-pangu": "^1.10.0",
53+
"@opd/babel-preset-component": "^1.11.0",
54+
"@opd/eslint-config-pangu": "^1.11.0",
55+
"@opd/jest-preset-pangu": "^1.11.0",
5756
"@opd/prettier-config-pangu": "^1.8.7",
5857
"@types/lodash": "^4.14.162",
5958
"@types/react": "^16.9.52",
@@ -63,14 +62,14 @@
6362
"canvas": "^2.6.1",
6463
"conventional-changelog-cli": "^2.1.0",
6564
"cross-env": "^7.0.2",
66-
"dumi": "^1.1.0-beta.24",
65+
"dumi": "^1.1.0-beta.25",
6766
"husky": "^4.3.0",
6867
"jest-canvas-mock": "^2.3.0",
6968
"lint-staged": "^10.4.0",
7069
"lodash": "^4.17.20",
71-
"react": "^16.13.1",
72-
"react-dom": "^16.13.1",
73-
"react-test-renderer": "^16.13.1",
70+
"react": "^16.14.0",
71+
"react-dom": "^16.14.0",
72+
"react-test-renderer": "^16.14.0",
7473
"typescript": "^4.0.3"
7574
},
7675
"prettier": "@opd/prettier-config-pangu",
@@ -80,7 +79,7 @@
8079
"react": "^15.0.0 || ^16.0.0"
8180
},
8281
"dependencies": {
83-
"@babel/runtime": "^7.11.2"
82+
"@babel/runtime": "^7.12.1"
8483
},
8584
"husky": {
8685
"hooks": {

src/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { RadarChartProps as _RadarChartProps } from './plots/radar'
1414
import { RoseChartProps as _RoseChartProps } from './plots/rose'
1515
import { ScatterChartProps as _ScatterChartProps } from './plots/scatter'
1616
import { WordCloudChartProps as _WordCloudChartProps } from './plots/word-cloud'
17+
import { WaterfallChartProps as _WaterfallChartProps } from './plots/waterfall'
1718

1819
// mini plots
1920
import { ProgressChartProps as _ProgressChartProps } from './plots/progress'
@@ -82,3 +83,6 @@ export type TinyColumnChartProps = _TinyColumnChartProps
8283

8384
export { default as TinyLineChart } from './plots/tiny-line'
8485
export type TinyLineChartProps = _TinyLineChartProps
86+
87+
export { default as WaterfallChart } from './plots/waterfall'
88+
export type WaterfallChartProps = _WaterfallChartProps

src/plots/waterfall/index.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React, { forwardRef } from 'react'
2+
import { Waterfall, WaterfallOptions } from '@antv/g2plot'
3+
import BaseChart, { BaseChartProps } from '../../components/base'
4+
5+
export type WaterfallChartProps = Omit<
6+
BaseChartProps<WaterfallOptions>,
7+
'chart'
8+
> &
9+
WaterfallOptions
10+
11+
const WaterfallChart = forwardRef<HTMLDivElement | null, WaterfallChartProps>(
12+
(props, ref) => {
13+
return <BaseChart chart={Waterfall} ref={ref} {...props} />
14+
}
15+
)
16+
17+
export default WaterfallChart

0 commit comments

Comments
 (0)