Skip to content

Commit

Permalink
AtiveRingChart 添加 digitalFlopToFixed 配置项
Browse files Browse the repository at this point in the history
  • Loading branch information
yizhiyuyou committed Jan 10, 2020
1 parent b39fa48 commit 3fc365f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 23 deletions.
20 changes: 0 additions & 20 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
{
"eslint.validate": [
"javascript",
"javascriptreact",
"vue-html",
{
"language": "typescript",
"autoFix": true
},
{
"language": "typescriptreact",
"autoFix": true
},
{
"language": "vue",
"autoFix": true
}
],
"eslint.run": "onSave",
"editor.formatOnSave": true,
"eslint.autoFixOnSave": true,
"prettier.eslintIntegration": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 1.1.2-alpha (2020-01-10)

### Perfect

- **AtiveRingChart:** 添加 digitalFlopToFixed 配置项.

# 1.1.1-alpha (2020-01-08)

### New
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jiaminghi/data-view-react",
"version": "1.1.1",
"version": "1.1.2",
"description": "React Large screen data display component library",
"author": "Duan Yu <[email protected]>",
"license": "MIT",
Expand Down
14 changes: 12 additions & 2 deletions src/components/activeRingChart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ const defaultConfig = {
fontSize: 25,
fill: '#fff'
},
/**
* @description Digital flop toFixed
* @type {Number}
*/
digitalFlopToFixed: 0,
/**
* @description CRender animationCurve
* @type {String}
Expand All @@ -90,15 +95,20 @@ const ActiveRingChart = ({ config = {}, className, style }) => {
const digitalFlop = useMemo(() => {
if (!mergedConfig) return {}

const { digitalFlopStyle, data } = mergedConfig
const { digitalFlopStyle, digitalFlopToFixed, data } = mergedConfig

const value = data.map(({ value }) => value)

const sum = value.reduce((all, v) => all + v, 0)

const percent = parseInt((value[activeIndex] / sum) * 100) || 0

return { content: '{nt}%', number: [percent], style: digitalFlopStyle }
return {
content: '{nt}%',
number: [percent],
style: digitalFlopStyle,
toFixed: digitalFlopToFixed
}
}, [mergedConfig, activeIndex])

const ringName = useMemo(
Expand Down

0 comments on commit 3fc365f

Please sign in to comment.