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

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

Comments

Projects
None yet
3 participants
@qingming418

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

This comment has been minimized.

Show comment
Hide comment
@warlock-lv

warlock-lv Oct 11, 2016

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

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

@wtyang

This comment has been minimized.

Show comment
Hide comment
@wtyang

wtyang Nov 25, 2016

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

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