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

x时间轴,xAxis设置min,max不能正常显示 #4097

Closed
qingming418 opened this issue Sep 18, 2016 · 2 comments
Closed

x时间轴,xAxis设置min,max不能正常显示 #4097

qingming418 opened this issue Sep 18, 2016 · 2 comments

Comments

@qingming418
Copy link

qingming418 commented Sep 18, 2016

问题简述 (One-line summary)

折线图,横轴为时间轴xAxis: { type: 'time' },里面设置min与max时,不能正常显示,图表无数据

image

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts3.0):
  • 浏览器类型和版本 (Browser version):
  • 操作系统类型和版本 (OS Version):

重现步骤 (Steps to reproduce)

期望结果 (Expected behaviour)

可能哪里有问题 (What went wrong)

ECharts配置项 (ECharts option)

代码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 mi;
var data = [];
var now = +new Date(1997, 9, 3);
var oneDay = 24 * 3600 * 1000;
var value = Math.random() * 1000;
for (var i = 0; i < 1000; i++) {
data.push(randomData());
}

option = {
title: {
text: '动态数据 + 时间坐标轴'
},
tooltip: {
trigger: 'axis',
formatter: function (params) {
params = params[0];
var date = new Date(params.name);
return date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear() + ' : ' + params.value[1];
},
axisPointer: {
animation: false
}
},
dataZoom: [
{
type: 'slider',
start: 0,
end: 100
},
{
type: 'inside',
start: 0,
end: 100
}
],
xAxis: {
type: 'time',
splitLine: {
show: false
},
min:new Date('1990/1/1')
},
yAxis: {
type: 'value',
boundaryGap: [0, '100%'],
splitLine: {
show: false
}
},
series: [{
name: '模拟数据',
type: 'line',
showSymbol: false,
hoverAnimation: false,
data: data
}]
};

其他信息 (Other comments)

image

@warlock-lv
Copy link

不要写min,max , 直接把你的带有时间的数据 写到series: 下的data 就行。

@wtyang
Copy link

wtyang commented Nov 25, 2016

这个问题困扰我两天,最后看了一下changelog,3.3.0版本修复了这个问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants