Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
wisdom-components
Commits
7a35b967
Commit
7a35b967
authored
Dec 14, 2022
by
崔佳豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 基本图表接收额外参数
parent
8a1e38fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
BarChart.js
packages/base-components/BasicChart/src/BarChart.js
+6
-2
LineChart.js
packages/base-components/BasicChart/src/LineChart.js
+5
-2
No files found.
packages/base-components/BasicChart/src/BarChart.js
View file @
7a35b967
...
...
@@ -22,7 +22,9 @@ const gradientColors = [
]),
);
const
BarChart
=
forwardRef
(({
category
,
dataSource
},
ref
)
=>
{
const
BarChart
=
forwardRef
((
props
,
ref
)
=>
{
const
{
category
,
dataSource
}
=
props
;
const
option
=
useMemo
(()
=>
{
const
xAxis
=
isCategory
(
category
)
?
{
...
...
@@ -50,7 +52,9 @@ const BarChart = forwardRef(({ category, dataSource }, ref) => {
return
{
xAxis
,
yAxis
,
series
};
},
[
category
,
dataSource
]);
return
<
ECharts
ref
=
{
ref
}
option
=
{
option
}
/>
;
const
restProps
=
_
.
omit
(
props
,
[
'category'
,
'dataSource'
]);
return
<
ECharts
ref
=
{
ref
}
option
=
{
option
}
{...
restProps
}
/>
;
});
BarChart
.
PropTypes
=
{
...
...
packages/base-components/BasicChart/src/LineChart.js
View file @
7a35b967
...
...
@@ -5,7 +5,8 @@ import _ from 'lodash';
const
isCategory
=
(
category
)
=>
category
!==
undefined
;
const
isArea
=
(
lineType
)
=>
lineType
===
'area'
;
const
LineChart
=
forwardRef
(({
category
,
lineType
,
smooth
,
dataSource
,
title
},
ref
)
=>
{
const
LineChart
=
forwardRef
((
props
,
ref
)
=>
{
const
{
category
,
lineType
,
smooth
,
dataSource
,
title
}
=
props
;
const
option
=
useMemo
(()
=>
{
const
titleCfg
=
typeof
title
===
'string'
?
{
show
:
true
,
text
}
:
{
show
:
false
};
const
xAxis
=
isCategory
(
category
)
...
...
@@ -35,7 +36,9 @@ const LineChart = forwardRef(({ category, lineType, smooth, dataSource, title },
return
{
xAxis
,
yAxis
,
series
,
title
:
titleCfg
};
},
[
category
,
smooth
,
lineType
,
dataSource
,
title
]);
return
<
ECharts
ref
=
{
ref
}
option
=
{
option
}
/>
;
const
restProps
=
_
.
omit
(
props
,
[
'category'
,
'lineType'
,
'smooth'
,
'dataSource'
,
'title'
]);
return
<
ECharts
ref
=
{
ref
}
option
=
{
option
}
{...
restProps
}
/>
;
});
LineChart
.
PropTypes
=
{
...
...
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