Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xAxis.type='time' + zoomData时卡顿问题 #8277

Closed
LonHon opened this issue May 3, 2018 · 5 comments
Closed

xAxis.type='time' + zoomData时卡顿问题 #8277

LonHon opened this issue May 3, 2018 · 5 comments
Labels
stale Inactive for a long time. Will be closed in 7 days.

Comments

@LonHon
Copy link

LonHon commented May 3, 2018

One-line summary [问题简述]

@pissang
使用折线图 series.length为2

已设置animation: false

xAxis.type='time' + zoomData时,目前1000条数据,当全部展示时卡顿比较严重,较小范围展示内存占用增加了100M。

同样的数据 xAxis.type='category' 时十分流畅。

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 4.0.4
  • Browser version [浏览器类型和版本]: Chrome 65.0.3325.162
  • OS Version [操作系统类型和版本]:
    小米pro 16G win10

Expected behaviour [期望结果]

卡顿效果能够优化

ECharts option [ECharts配置项]

option = {

}

Other comments [其他信息]

@pissang
Copy link
Contributor

pissang commented May 4, 2018

能否发我们下完整的能够复现的 option

@LonHon
Copy link
Author

LonHon commented May 7, 2018

抱歉,option是动态修改的,数据2000条左右,主要配置:

  1. 折线图
  2. 两个Y轴
  3. X轴设置了formatter

其余的为默认设置。


感觉zoomData拖动时卡顿问题出在 x轴文本的格式化上

刚刚试了下,如果没有使用axisLabel则拖动流畅,添加格式化方法后会明显卡顿

然后xAxis.type='time' 时,从效果上看也是动态调整了axisLabel。

@LonHon
Copy link
Author

LonHon commented May 7, 2018

xAxis.type='time' 时通过以下方法解决:

  1. series中设置 showSymbol: false, hoverAnimation: false
  2. option中设置 animation: false, animationDurationUpdate: 0

@LonHon LonHon closed this as completed May 7, 2018
@LonHon
Copy link
Author

LonHon commented May 9, 2018

@pissang 虽然个人已经解决卡顿问题,还是放上option供你们去寻找原因。

官方demo: http://echarts.baidu.com/examples/editor.html?c=dynamic-data2

电脑配置是小米pro顶配,在数据量4000时会明显卡顿,应该是渲染 series ** showSymbol, hoverAnimation ** 存在问题

代码

function randomData() {
    now = new Date(+now + oneDay);
    value = value + Math.random() * 21 - 10;
    return {
        name: now.toString(),
        value: [
            [now.getFullYear(), now.getMonth() + 1, now.getDate()].join('/'),
            Math.round(value)
        ]
    }
}

var data = [], data1 = [], timeline = [];
var now = +new Date(1997, 9, 3);
var oneDay = 24 * 3600 * 1000;
var value = Math.random() * 1000;
for (var i = 0; i < 4000; i++) {
    data.push(randomData());
}

option = {
    title: {
        text: '动态数据 + 时间坐标轴'
    },
    tooltip: {
        trigger: 'axis'
    },
    xAxis: {
        type: 'time'
    },
    yAxis: [{
        type: 'value',
        boundaryGap: [0, '100%']
    },{
        type: 'value',
        boundaryGap: [0, '100%']
    }],
    series: [{
        name: '模拟数据',
        type: 'line',
        data: data
    }],
};

@stale
Copy link

stale bot commented May 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Inactive for a long time. Will be closed in 7 days. label May 8, 2020
@stale stale bot closed this as completed May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Inactive for a long time. Will be closed in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants