From 805aa459e8b98a46b0f3ce3de1965f5807e854bc Mon Sep 17 00:00:00 2001 From: kagawagao Date: Fri, 28 Feb 2020 15:45:47 +0800 Subject: [PATCH] feat: support SunburstChart --- README.md | 1 + .../__snapshots__/sunburst.spec.tsx.snap | 3 ++ __tests__/plots/sunburst.spec.tsx | 11 ++++ package-lock.json | 51 +++++++------------ package.json | 2 +- src/plots/sunburst.tsx | 11 ++++ 6 files changed, 44 insertions(+), 35 deletions(-) create mode 100644 __tests__/plots/__snapshots__/sunburst.spec.tsx.snap create mode 100644 __tests__/plots/sunburst.spec.tsx create mode 100644 src/plots/sunburst.tsx diff --git a/README.md b/README.md index 35691bd9..52c262d1 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ Extra Props: - [x] [`AVAChart`](https://github.com/antvis/AVA) - [x] [`BulletChart`](https://g2plot.antv.vision/zh/examples/bullet/basic) - [x] [`TreemapChart`](https://g2plot.antv.vision/zh/examples/treemap/rect) +- [x] `SunburstChart` ## Develop diff --git a/__tests__/plots/__snapshots__/sunburst.spec.tsx.snap b/__tests__/plots/__snapshots__/sunburst.spec.tsx.snap new file mode 100644 index 00000000..83df13e8 --- /dev/null +++ b/__tests__/plots/__snapshots__/sunburst.spec.tsx.snap @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`SunburstChart should render without crashed 1`] = `
`; diff --git a/__tests__/plots/sunburst.spec.tsx b/__tests__/plots/sunburst.spec.tsx new file mode 100644 index 00000000..1f3e452c --- /dev/null +++ b/__tests__/plots/sunburst.spec.tsx @@ -0,0 +1,11 @@ +import React from 'react' +import { create } from 'react-test-renderer' +import SunburstChart from '../../src/plots/sunburst' + +describe('SunburstChart', () => { + test('should render without crashed', () => { + const renderer = create() + + expect(renderer.toJSON()).toMatchSnapshot() + }) +}) diff --git a/package-lock.json b/package-lock.json index 0749e368..35838f7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,9 +5,9 @@ "requires": true, "dependencies": { "@antv/adjust": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@antv/adjust/-/adjust-0.2.1.tgz", - "integrity": "sha512-e8nDWRxWc/ACnCvBDpKWco1JBePGPPPLeDjOhicHaZ11GytnPfVJm9iymehMQ+CcRjOVXelWYpWJSSXncfNiog==", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@antv/adjust/-/adjust-0.2.2.tgz", + "integrity": "sha512-b5cABT0WWgKU8pfhW2ssID4FBXDBnHPuxU/HAV3nOMq1lso2BI2/r1hHnrVMZId5Dntb7YrVTOsokiD9DFZ2+w==", "requires": { "@antv/util": "~2.0.0", "tslib": "^1.10.0" @@ -131,9 +131,9 @@ } }, "@antv/g2": { - "version": "3.6.0-beta.18", - "resolved": "https://registry.npmjs.org/@antv/g2/-/g2-3.6.0-beta.18.tgz", - "integrity": "sha512-QsuUlo0yKYh2AP8W2oB3BmtlQI5HL0p76ztPMSFq0DFj5oW+SFFeE0yf45iIkFrpEWDvrAreVUg+vtQmYuhSqg==", + "version": "3.6.0-beta.19", + "resolved": "https://registry.npmjs.org/@antv/g2/-/g2-3.6.0-beta.19.tgz", + "integrity": "sha512-b57+teizhcJ0+OBXHgwziMS8gM4tXNjmQ5OjEu4DrtM7QERNwgf7ZNEgsZ8xQ/4EXw0a/T92YAeegHHVu6dVqA==", "requires": { "@antv/adjust": "~0.2.0", "@antv/attr": "~0.3.1", @@ -150,12 +150,12 @@ } }, "@antv/g2plot": { - "version": "0.11.32", - "resolved": "https://registry.npmjs.org/@antv/g2plot/-/g2plot-0.11.32.tgz", - "integrity": "sha512-9mmCQSOd9CyyWeB+FX1dxBYF6mlV1fCoIJkWBz7HnMaEob8LsUCjMvfqN03roYaCcD9Hhxe4riuyA17F0++RqA==", + "version": "0.11.33", + "resolved": "https://registry.npmjs.org/@antv/g2plot/-/g2plot-0.11.33.tgz", + "integrity": "sha512-FZmJSfvYq9hWa2Md//MBjsE0d7eWbkfGS+UIPBd1P9bm7/XjtpSM2Wf+gXFaLQPRPtAV/G9nqcuxAmy1XOPf+A==", "requires": { "@antv/g-gesture": "~0.1.0", - "@antv/g2": "~3.6.0-beta.18", + "@antv/g2": "~3.6.0-beta.19", "@antv/gui": "~0.1.0", "d3-regression": "^1.2.8", "fecha": "~4.1.0", @@ -169,28 +169,16 @@ "integrity": "sha512-oOWcVNlpELIKi9x+Mm1Vwbz8pXfkbJKykoCIOJ/dNK79hSIANbpXJ5d3Rra9/wZqK6MC961B7sybFhPlLraT3Q==" }, "@antv/gui": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@antv/gui/-/gui-0.1.0.tgz", - "integrity": "sha512-FDxZHXHrryqtERsVR/61+dwIATik1jk9gIk+H/KTMjVTCXBuQHlHW9ySEFwBEO3Iw7cjnRo4a+7NBMLSutucQA==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@antv/gui/-/gui-0.1.1.tgz", + "integrity": "sha512-yOM2yInhTMu+z3xJ8RnD09n4Vib3BDVMIcE9XpYzjbCRDPFkvE4QToJS+ajU12+a3pIxnJb8/FJ6YcsRzEkuDA==", "requires": { "@antv/dom-util": "^2.0.1", "@antv/g": "~3.5.0-beta.1", "@antv/path-util": "^2.0.0", - "@antv/scale": "~0.2.0", + "@antv/scale": "~0.3.0", "@antv/util": "~2.0.0", "tslib": "^1.10.0" - }, - "dependencies": { - "@antv/scale": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@antv/scale/-/scale-0.2.3.tgz", - "integrity": "sha512-SDniBuf9b5n7dAm7cXpJCFRRWbHzhzHmxs28KRkayas13lfftKXzHrMRjmdhIv5XzIByDBH9Yv2ln46mt9ZVrg==", - "requires": { - "@antv/util": "~2.0.3", - "moment": "^2.24.0", - "tslib": "^1.10.0" - } - } } }, "@antv/knowledge": { @@ -212,9 +200,9 @@ } }, "@antv/path-util": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@antv/path-util/-/path-util-2.0.4.tgz", - "integrity": "sha512-1oXQS7/rwidNeKVCqK3wRstl4SuId7++JrMdyMjaVVTWYtupvpIVG4GKsHDNR/mnRvU/fUmTfw8VMlSNu6Xjgw==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@antv/path-util/-/path-util-2.0.5.tgz", + "integrity": "sha512-AHRzDoPRLOXFbCPLB/moOtuCF8NjiMf//36zDzuaAiBMnNmrqyxvHM2JYaDiIOqfmDAbA7no+2mS2qiTXg5WVg==", "requires": { "@antv/util": "~2.0.0", "tslib": "^1.10.0" @@ -20903,11 +20891,6 @@ "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", "dev": true }, - "moment": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", - "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", diff --git a/package.json b/package.json index b8705b64..ee8a88e4 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "dependencies": { "@antv/chart-advisor": "0.0.2-alpha.17", "@antv/g": "^3.5.0-beta.3", - "@antv/g2plot": "^0.11.32" + "@antv/g2plot": "^0.11.33" }, "husky": { "hooks": { diff --git a/src/plots/sunburst.tsx b/src/plots/sunburst.tsx new file mode 100644 index 00000000..fffd2c91 --- /dev/null +++ b/src/plots/sunburst.tsx @@ -0,0 +1,11 @@ +import React, { FC } from 'react' +import { Sunburst, SunburstConfig } from '@antv/g2plot' +import BaseChart, { BaseChartProps } from './base' + +export type SunburstChartProps = Omit & SunburstConfig + +const SunburstChart: FC = props => { + return +} + +export default SunburstChart