Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d7d74665
authored
Oct 27, 2024
by
zhou
Committed by
GitHub
Oct 27, 2024
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: fix renderEcharts refresh issue (#4741)
1 parent
6688a6b3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
packages/effects/plugins/src/echarts/use-echarts.ts
packages/effects/plugins/src/echarts/use-echarts.ts
View file @
d7d7466
...
...
@@ -31,12 +31,11 @@ function useEcharts(chartRef: Ref<EchartsUIType>) {
const
getOptions
=
computed
(():
EChartsOption
=>
{
if
(
!
isDark
.
value
)
{
return
cacheOptions
;
return
{}
;
}
return
{
backgroundColor
:
'transparent'
,
...
cacheOptions
,
};
});
...
...
@@ -52,10 +51,14 @@ function useEcharts(chartRef: Ref<EchartsUIType>) {
const
renderEcharts
=
(
options
:
EChartsOption
,
clear
=
true
)
=>
{
cacheOptions
=
options
;
const
currentOptions
=
{
...
options
,
...
getOptions
.
value
,
};
return
new
Promise
((
resolve
)
=>
{
if
(
chartRef
.
value
?.
offsetHeight
===
0
)
{
useTimeoutFn
(()
=>
{
renderEcharts
(
getOptions
.
value
);
renderEcharts
(
currentOptions
);
resolve
(
null
);
},
30
);
return
;
...
...
@@ -67,7 +70,7 @@ function useEcharts(chartRef: Ref<EchartsUIType>) {
if
(
!
instance
)
return
;
}
clear
&&
chartInstance
?.
clear
();
chartInstance
?.
setOption
(
getOptions
.
value
);
chartInstance
?.
setOption
(
currentOptions
);
resolve
(
null
);
},
30
);
});
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment