-
Notifications
You must be signed in to change notification settings - Fork 368
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat:添加打包图circle packing * fix:删除仓库地址 * fix:删除已内置的baseOptions --------- Co-authored-by: xifandong.dxf <xifandong.dxf@digital-engine.com> Co-authored-by: Joel Alan <31396322+lxfu1@users.noreply.github.com>
- Loading branch information
1 parent
38e9136
commit 6ba8222
Showing
10 changed files
with
110 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
import { CirclePackingOptions } from '../../core'; | ||
import { CommonConfig } from '../../interface'; | ||
import { BaseChart } from '../base'; | ||
|
||
export type CirclePackingConfig = CommonConfig<CirclePackingOptions>; | ||
|
||
const CirclePackingChart = (props: CirclePackingConfig) => <BaseChart {...props} chartType="CirclePacking" />; | ||
|
||
export default CirclePackingChart; |
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
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,14 @@ | ||
import { flow, transformOptions } from '../../utils'; | ||
import type { Adaptor } from '../../types'; | ||
import type { CirclePackingOptions } from './type'; | ||
|
||
type Params = Adaptor<CirclePackingOptions>; | ||
|
||
/** | ||
* @param chart | ||
* @param options | ||
*/ | ||
export function adaptor(params: Params) { | ||
|
||
return flow(transformOptions)(params); | ||
} |
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,40 @@ | ||
import { Plot } from '../../base'; | ||
import { adaptor } from './adaptor'; | ||
|
||
import type { CirclePackingOptions } from './type'; | ||
import type { Adaptor } from '../../types'; | ||
|
||
export type { CirclePackingOptions }; | ||
|
||
export class CirclePacking extends Plot<CirclePackingOptions> { | ||
/** 图表类型 */ | ||
public type = 'CirclePacking'; | ||
|
||
/** | ||
* 获取 circle packing 默认配置项 | ||
* 供外部使用 | ||
*/ | ||
static getDefaultOptions(): Partial<CirclePackingOptions> { | ||
return { | ||
legend: false, | ||
type: "view", | ||
children: [{ | ||
type: "pack" | ||
}] | ||
}; | ||
} | ||
|
||
/** | ||
* 获取 打包图 默认配置 | ||
*/ | ||
protected getDefaultOptions() { | ||
return CirclePacking.getDefaultOptions(); | ||
} | ||
|
||
/** | ||
* 打包图适配器 | ||
*/ | ||
protected getSchemaAdaptor(): (params: Adaptor<CirclePackingOptions>) => void { | ||
return adaptor; | ||
} | ||
} |
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,3 @@ | ||
import type { Options } from '../../types/common'; | ||
|
||
export type CirclePackingOptions = Options; |
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,27 @@ | ||
|
||
|
||
import { CirclePacking } from '@ant-design/plots'; | ||
import { interpolateHcl } from 'd3-interpolate'; | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
const DemoCirclePacking = () => { | ||
|
||
const config = { | ||
data: { | ||
type: "fetch", | ||
value: "https://assets.antv.antgroup.com/g2/flare.json", | ||
}, | ||
valueField: "value", | ||
colorField: "depth", | ||
scale: { | ||
color: { | ||
domain: [0, 5], | ||
range: ["hsl(152,80%,80%)", "hsl(228,30%,40%)"], | ||
interpolate: interpolateHcl | ||
}, | ||
}, | ||
}; | ||
return <CirclePacking {...config} />; | ||
}; | ||
|
||
ReactDOM.render(<DemoCirclePacking />, document.getElementById('container')); |
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