不想把X轴放在0点上,或者把X轴的点移上去? 还有Y轴的值在gallery为什么是这样的,很多个0000... 本地跑就不会?
配置项如下
var now = +new Date();
var oneMinute = 60 * 1000;
function randomData() {
now = new Date(+now + oneMinute);
fatigue = Math.random() * 2 - 1;
return {
value: [
[now.getHours(), now.getMinutes()].join(":"),
Math.round(fatigue*100)/100
]
}
}
var data = [];
var x = [];
var now = new Date()
for(var i = 0; i < 50; i++) {
var item = randomData();
data.push(item)
x.push(item.value[0])
}
var option = {
xAxis: {
// type: 'catagory',
// boundaryGap: [0, '100%'],
// splitLine: {
// show: false
// },
// position: "bottom",
// offset: "10",
data: x
},
yAxis: {
type: 'value',
// boundaryGap: [0, '100%'],
splitLine: {
show: false
}
},
series: [{
name: '模拟数据',
type: 'line',
showSymbol: false,
hoverAnimation: false,
data: data
}]
};