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
A
ant-design-pro
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
ant-design-pro
Commits
c8ea5979
Commit
c8ea5979
authored
Apr 28, 2019
by
ιεΈ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove auto width
parent
a2cca354
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
41 deletions
+44
-41
src/components/Charts/Pie/index.js
src/components/Charts/Pie/index.js
+44
-41
No files found.
src/components/Charts/Pie/index.js
View file @
c8ea5979
...
...
@@ -12,7 +12,6 @@ import styles from './index.less';
/* eslint react/no-danger:0 */
class
Pie
extends
Component
{
state
=
{
width
:
0
,
height
:
0
,
legendData
:
[],
legendBlock
:
false
,
...
...
@@ -96,19 +95,18 @@ class Pie extends Component {
resizeObserver
()
{
const
ro
=
new
ResizeObserver
(
entries
=>
{
const
{
width
,
height
}
=
entries
[
0
].
contentRect
;
this
.
setState
(
(
preState
,
{
hasLegend
})
=>
{
if
(
preState
.
width
!==
width
||
preState
.
height
!==
height
)
{
const
{
height
}
=
entries
[
0
].
contentRect
;
this
.
setState
(
preState
=>
{
if
(
preState
.
height
!==
height
)
{
return
{
width
:
width
-
(
hasLegend
?
240
:
0
),
height
,
};
}
return
null
;
});
});
if
(
this
.
root
)
{
ro
.
observe
(
this
.
root
);
if
(
this
.
chartDom
)
{
ro
.
observe
(
this
.
chartDom
);
}
}
...
...
@@ -152,7 +150,7 @@ class Pie extends Component {
lineWidth
=
1
,
}
=
this
.
props
;
const
{
legendData
,
height
:
StateHeight
,
width
,
legendBlock
}
=
this
.
state
;
const
{
legendData
,
height
:
stateHeight
,
legendBlock
}
=
this
.
state
;
const
pieClassName
=
classNames
(
styles
.
pie
,
className
,
{
[
styles
.
hasLegend
]:
!!
hasLegend
,
[
styles
.
legendBlock
]:
legendBlock
,
...
...
@@ -225,13 +223,17 @@ class Pie extends Component {
return
(
<
div
ref
=
{
this
.
handleRoot
}
className
=
{
pieClassName
}
style
=
{
style
}
>
<
div
ref
=
{
ref
=>
{
this
.
chartDom
=
ref
;
}}
>
<
ReactFitText
maxFontSize
=
{
25
}
>
<
div
className
=
{
styles
.
chart
}
>
<
Chart
scale
=
{
scale
}
height
=
{
height
||
S
tateHeight
}
height
=
{
height
||
s
tateHeight
}
data
=
{
dv
}
width
=
{
width
}
padding
=
{
padding
}
animate
=
{
animate
}
onGetG2Instance
=
{
this
.
getG2Instance
}
...
...
@@ -259,6 +261,7 @@ class Pie extends Component {
)}
<
/div
>
<
/ReactFitText
>
<
/div
>
{
hasLegend
&&
(
<
ul
className
=
{
styles
.
legend
}
>
{
legendData
.
map
((
item
,
i
)
=>
(
...
...
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