yuhao-git opened a new issue, #18162:
URL: https://github.com/apache/echarts/issues/18162
### Version
5.4.1
### Link to Minimal Reproduction
_No response_
### Steps to Reproduce
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- <script type="text/javascript"
src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script> -->
<script type="text/javascript"
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"></script>
<title>Document</title>
<style>
.chart{
height: 300px;
width: 500px;
border: 1px solid;
}
</style>
</head>
<body>
<div class="chart" id="chart"></div>
</body>
<script>
let chart = echarts.init(document.getElementById('chart'));
function getOption() {
let option = {
xAxis: {
type: "category",
data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
},
yAxis: {
type: "value",
},
series: [
{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: "line",
smooth: true,
},
],
};
return option;
};
function drawChart(){
// chart?.dispose?.();
// chart = echarts.init(document.getElementById('chart'))
chart.clear();
chart.setOption(getOption());
}
setInterval(() => {
drawChart()
}, 1000);
</script>
</html>
### Current Behavior
用setInterval定时刷新图表,每次都有少量的内泄漏;
<img width="1199" alt="微信截图_20230111150916"
src="https://user-images.githubusercontent.com/45466643/211741721-25a428cd-8416-4c5e-886f-586bba6cb1a9.png">
### Expected Behavior
回收所有内存;
### Environment
```markdown
- OS:
- Browser:
- Framework:
```
### Any additional comments?
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]