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
cfc7d5f6
Commit
cfc7d5f6
authored
Feb 24, 2023
by
李纪文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 图表支持主题
parent
8d167bbb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
12 deletions
+24
-12
color.js
packages/base-components/BasicChart/src/utils/color.js
+23
-12
index.js
packages/base-components/BasicChart/src/utils/index.js
+1
-0
No files found.
packages/base-components/BasicChart/src/utils/color.js
View file @
cfc7d5f6
import
_
from
'lodash'
;
import
*
as
echarts
from
'echarts/core'
;
import
{
globalConfig
}
from
'antd/lib/config-provider'
;
const
BASE_COLORS
=
[
'#1685ff'
,
'#00b809'
,
'#ffa200'
,
'#00d0c7'
,
'#ff6b37'
,
'#986aff'
,
'#2f54eb'
,
'#ff9e69'
,
'#ffcb66'
,
'#99ceff'
,
];
const
THEME_LIST
=
{
'#009C73'
:
[
'#01AA55'
,
'#1685FF'
,
'#FFB424'
,
'#19D2BA'
,
'#5842FF'
],
'#0087F7'
:
BASE_COLORS
,
'#1890FF'
:
BASE_COLORS
,
};
const
THEME
=
window
.
globalConfig
?.
variableTheme
?.
primaryColor
;
/**
* 16进制颜色值转rgba颜色值
...
...
@@ -17,18 +39,7 @@ export const hexToRgba = (hex, opacity = 1) => {
};
// 图表基础配色
export
const
DEF_COLORS
=
[
'#1685ff'
,
'#00b809'
,
'#ffa200'
,
'#00d0c7'
,
'#ff6b37'
,
'#986aff'
,
'#2f54eb'
,
'#ff9e69'
,
'#ffcb66'
,
'#99ceff'
,
];
export
const
DEF_COLORS
=
THEME
?
THEME_LIST
[
THEME
]
||
BASE_COLORS
:
BASE_COLORS
;
// 图表基础配色对应的线性渐变色, 适用面积曲线图
export
const
DEF_GRAD_COLORS
=
DEF_COLORS
.
map
((
color
)
=>
{
...
...
packages/base-components/BasicChart/src/utils/index.js
View file @
cfc7d5f6
...
...
@@ -3,6 +3,7 @@ import { buildDefaultOption, buildSpecificOption } from './default';
import
*
as
color
from
'./color'
;
const
buildOption
=
(
option
)
=>
{
option
=
option
||
{};
const
exports
=
{};
const
defaultOption
=
buildDefaultOption
(
option
);
const
specificOption
=
buildSpecificOption
(
option
);
...
...
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