-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add TreemapChart and BulletChart support
- Loading branch information
Showing
6 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react' | ||
import { create } from 'react-test-renderer' | ||
import BulletChart from '../../src/plots/bullet' | ||
|
||
describe('BulletChart', () => { | ||
test('should render without crashed', () => { | ||
const renderer = create( | ||
<BulletChart | ||
rangeMax={100} | ||
data={[ | ||
{ | ||
targets: [90], | ||
measures: [0.9], | ||
}, | ||
]} | ||
/> | ||
) | ||
|
||
expect(renderer.toJSON()).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from 'react' | ||
import { create } from 'react-test-renderer' | ||
import TreemapChart from '../../src/plots/treemap' | ||
|
||
describe('TreemapChart', () => { | ||
test('should render without crashed', () => { | ||
const renderer = create(<TreemapChart data={[]} colorField="x" />) | ||
|
||
expect(renderer.toJSON()).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React, { FC } from 'react' | ||
import { Bullet, BulletConfig } from '@antv/g2plot' | ||
import BaseChart, { BaseChartProps } from './base' | ||
|
||
export type BulletChartProps = Omit<BaseChartProps, 'chart'> & BulletConfig | ||
|
||
const BulletChart: FC<BulletChartProps> = props => { | ||
return <BaseChart chart={Bullet} {...props} /> | ||
} | ||
|
||
export default BulletChart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React, { FC } from 'react' | ||
import { Treemap } from '@antv/g2plot' | ||
import BaseChart, { BaseChartProps } from './base' | ||
// FIXME: fix this after https://github.com/antvis/G2Plot/pull/652 merged | ||
import { TreemapConfig } from '@antv/g2plot/lib/plots/treemap' | ||
|
||
export type TreemapChartProps = Omit<BaseChartProps, 'chart'> & TreemapConfig | ||
|
||
const TreemapChart: FC<TreemapChartProps> = props => { | ||
return <BaseChart chart={Treemap} {...props} /> | ||
} | ||
|
||
export default TreemapChart |