Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pro-blocks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
pro-blocks
Commits
378d9ae1
Commit
378d9ae1
authored
Oct 24, 2017
by
afc163
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pie
parent
1a1aa957
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
12 deletions
+19
-12
src/components/Charts/Pie/index.js
src/components/Charts/Pie/index.js
+10
-7
src/components/Charts/index.md
src/components/Charts/index.md
+2
-2
src/routes/Dashboard/Analysis.js
src/routes/Dashboard/Analysis.js
+4
-3
src/routes/Dashboard/Analysis.less
src/routes/Dashboard/Analysis.less
+3
-0
No files found.
src/components/Charts/Pie/index.js
View file @
378d9ae1
...
@@ -60,6 +60,7 @@ class Pie extends Component {
...
@@ -60,6 +60,7 @@ class Pie extends Component {
inner
=
0.75
,
inner
=
0.75
,
animate
=
true
,
animate
=
true
,
colors
,
colors
,
lineWidth
=
0
,
}
=
this
.
props
;
}
=
this
.
props
;
const
defaultColors
=
colors
||
[
'
#8543E0
'
,
'
#F04864
'
,
'
#FACC14
'
,
'
#1890FF
'
,
'
#13C2C2
'
,
'
#2FC25B
'
];
const
defaultColors
=
colors
||
[
'
#8543E0
'
,
'
#F04864
'
,
'
#FACC14
'
,
'
#1890FF
'
,
'
#13C2C2
'
,
'
#2FC25B
'
];
...
@@ -73,9 +74,9 @@ class Pie extends Component {
...
@@ -73,9 +74,9 @@ class Pie extends Component {
tooltip
=
false
;
tooltip
=
false
;
formatColor
=
(
value
)
=>
{
formatColor
=
(
value
)
=>
{
if
(
value
===
'
占比
'
)
{
if
(
value
===
'
占比
'
)
{
return
color
||
'
#0096fa
'
;
return
color
||
'
rgba(24, 144, 255, 0.85)
'
;
}
else
{
}
else
{
return
'
#
e9e9e9
'
;
return
'
#
F0F2F5
'
;
}
}
};
};
...
@@ -149,11 +150,13 @@ class Pie extends Component {
...
@@ -149,11 +150,13 @@ class Pie extends Component {
inner
,
inner
,
});
});
if
(
percent
)
{
chart
chart
.
intervalStack
().
position
(
Stat
.
summary
.
percent
(
'
y
'
)).
color
(
'
x
'
,
formatColor
).
selected
(
selected
);
.
intervalStack
()
}
else
{
.
position
(
Stat
.
summary
.
percent
(
'
y
'
))
chart
.
intervalStack
().
position
(
Stat
.
summary
.
percent
(
'
y
'
)).
color
(
'
x
'
,
defaultColors
).
selected
(
selected
);
.
style
({
lineWidth
,
stroke
:
'
#fff
'
})
}
.
color
(
'
x
'
,
percent
?
formatColor
:
defaultColors
)
.
selected
(
selected
);
chart
.
render
();
chart
.
render
();
this
.
chart
=
chart
;
this
.
chart
=
chart
;
...
...
src/components/Charts/index.md
View file @
378d9ae1
...
@@ -56,7 +56,7 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https
...
@@ -56,7 +56,7 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https
| 参数 | 说明 | 类型 | 默认值 |
| 参数 | 说明 | 类型 | 默认值 |
|----------|------------------------------------------|-------------|-------|
|----------|------------------------------------------|-------------|-------|
| title | 图表标题 | ReactNode
\|
string | - |
| title | 图表标题 | ReactNode
\|
string | - |
| color | 图表颜色 | string |
`
#
rgba(24, 144, 255, 0.85)`
|
| color | 图表颜色 | string |
`rgba(24, 144, 255, 0.85)`
|
| margin | 图表内部间距 | array |
\[
32, 0, 32, 40
\]
|
| margin | 图表内部间距 | array |
\[
32, 0, 32, 40
\]
|
| height | 图表高度 | number | - |
| height | 图表高度 | number | - |
| data | 数据 | array
<
{
x
,
y
}
>
| - |
| data | 数据 | array
<
{
x
,
y
}
>
| - |
...
@@ -66,7 +66,7 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https
...
@@ -66,7 +66,7 @@ Ant Design Pro 提供的业务中常用的图表类型,都是基于 [G2](https
| 参数 | 说明 | 类型 | 默认值 |
| 参数 | 说明 | 类型 | 默认值 |
|----------|------------------------------------------|-------------|-------|
|----------|------------------------------------------|-------------|-------|
| animate | 是否显示动画 | boolean | true |
| animate | 是否显示动画 | boolean | true |
| color | 图表颜色 | string |
`
#0096fa
`
|
| color | 图表颜色 | string |
`
rgba(24, 144, 255, 0.85)
`
|
| height | 图表高度 | number | - |
| height | 图表高度 | number | - |
| hasLegend | 是否显示 legend | boolean |
`false`
|
| hasLegend | 是否显示 legend | boolean |
`false`
|
| margin | 图表内部间距 | array |
\[
32, 0, 32, 40
\]
|
| margin | 图表内部间距 | array |
\[
32, 0, 32, 40
\]
|
...
...
src/routes/Dashboard/Analysis.js
View file @
378d9ae1
...
@@ -161,7 +161,7 @@ export default class Analysis extends Component {
...
@@ -161,7 +161,7 @@ export default class Analysis extends Component {
<
Col
span
=
{
12
}
style
=
{{
paddingTop
:
36
}}
>
<
Col
span
=
{
12
}
style
=
{{
paddingTop
:
36
}}
>
<
Pie
<
Pie
animate
=
{
false
}
animate
=
{
false
}
color
=
{(
currentKey
!==
data
.
name
)
&&
'
#
99d5fd
'
}
color
=
{(
currentKey
!==
data
.
name
)
&&
'
#
BDE4FF
'
}
inner
=
{
0.55
}
inner
=
{
0.55
}
tooltip
=
{
false
}
tooltip
=
{
false
}
margin
=
{[
0
,
0
,
0
,
0
]}
margin
=
{[
0
,
0
,
0
,
0
]}
...
@@ -386,7 +386,7 @@ export default class Analysis extends Component {
...
@@ -386,7 +386,7 @@ export default class Analysis extends Component {
)}
)}
style
=
{{
marginTop
:
24
}}
style
=
{{
marginTop
:
24
}}
>
>
<
div
style
=
{{
marginTop
:
32
,
marginBottom
:
10
8
}}
>
<
div
style
=
{{
marginTop
:
32
,
marginBottom
:
10
0
}}
>
<
Pie
<
Pie
hasLegend
hasLegend
title
=
"
销售额
"
title
=
"
销售额
"
...
@@ -394,7 +394,8 @@ export default class Analysis extends Component {
...
@@ -394,7 +394,8 @@ export default class Analysis extends Component {
total
=
{
yuan
(
salesPieData
.
reduce
((
pre
,
now
)
=>
now
.
y
+
pre
,
0
))}
total
=
{
yuan
(
salesPieData
.
reduce
((
pre
,
now
)
=>
now
.
y
+
pre
,
0
))}
data
=
{
salesPieData
}
data
=
{
salesPieData
}
valueFormat
=
{
val
=>
yuan
(
val
)}
valueFormat
=
{
val
=>
yuan
(
val
)}
height
=
{
260
}
height
=
{
268
}
lineWidth
=
{
4
}
/
>
/
>
<
/div
>
<
/div
>
<
/Card
>
<
/Card
>
...
...
src/routes/Dashboard/Analysis.less
View file @
378d9ae1
...
@@ -150,6 +150,9 @@
...
@@ -150,6 +150,9 @@
.salesCard {
.salesCard {
:global {
:global {
.abt-tabs-ink-bar {
bottom: auto;
}
.ant-tabs-content {
.ant-tabs-content {
padding-top: 30px;
padding-top: 30px;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment