-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
202 additions
and
51 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
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 |
---|---|---|
@@ -1,3 +1,11 @@ | ||
import type { BaseOptions, Options } from '../../types/common'; | ||
|
||
export type BarOptions = Options & BaseOptions; | ||
type CommonOptions = Options & BaseOptions; | ||
|
||
export type BarOptions = Options & | ||
BaseOptions & { | ||
/** | ||
* @title mark 背景配置 | ||
*/ | ||
markBackground?: CommonOptions; | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import type { BaseOptions, Options } from '../../types/common'; | ||
import type { BarOptions } from '../bar/type'; | ||
|
||
export type ColumnOptions = Options & BaseOptions; | ||
export type ColumnOptions = BarOptions; |
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export const isValidElement = (jsxCode: string): boolean => { | ||
const jsxRegex = /react(.*?).createElement/gi; | ||
const jsxRegex = /react/i; | ||
|
||
return jsxRegex.test(jsxCode); | ||
}; |
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,71 @@ | ||
import { Bar } from '@ant-design/plots'; | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
const data = [ | ||
{ | ||
labelName: '蓝领', | ||
value: 110, | ||
}, | ||
{ | ||
labelName: '白领', | ||
value: 220, | ||
}, | ||
{ | ||
labelName: '制造业蓝领', | ||
value: 330, | ||
}, | ||
{ | ||
labelName: '退休人员', | ||
value: 440, | ||
}, | ||
]; | ||
|
||
const DemoBar = () => { | ||
const config = { | ||
data, | ||
xField: 'labelName', | ||
yField: 'value', | ||
paddingRight: 80, | ||
style: { | ||
maxWidth: 25, | ||
}, | ||
markBackground: { | ||
label: { | ||
text: (d) => { | ||
return `${(d.value / 1000) * 100}% | ${d.value}`; | ||
}, | ||
position: 'right', | ||
dx: 80, | ||
style: { | ||
fill: '#aaa', | ||
fillOpacity: 1, | ||
fontSize: 14, | ||
}, | ||
}, | ||
style: { | ||
fill: '#eee', | ||
}, | ||
}, | ||
scale: { | ||
y: { | ||
domain: [0, 1000], | ||
}, | ||
}, | ||
axis: { | ||
x: { | ||
tick: false, | ||
title: false, | ||
}, | ||
y: { | ||
grid: false, | ||
tick: false, | ||
label: false, | ||
title: false, | ||
}, | ||
}, | ||
}; | ||
return <Bar {...config} />; | ||
}; | ||
|
||
ReactDOM.render(<DemoBar />, 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
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