newup

parent 34798fcc
......@@ -32,11 +32,11 @@ class App extends Component {
})
// console.log(data.result.AxisX.BlockTime,'开始')
var timeee=moment(data.result.AxisX.BlockTime/1000000)
timeee.format('YYYY-MM-DD HH:mm:ss')
timeee.add(this.state.duration,'seconds').format('YYYY-MM-DD HH:mm:ss')
var maxtime=moment(data.result.AxisX.BlockTime/1000000)
maxtime.format('YYYY-MM-DD HH:mm:ss')
maxtime.add(this.state.duration,'seconds').format('YYYY-MM-DD HH:mm:ss')
timeee.unix()
maxtime.unix()
var mintime=moment(data.result.AxisX.BlockTime/1000000)
......@@ -85,15 +85,13 @@ class App extends Component {
})
if(this.state.duration<0){
timeee=moment(data.result.AxisX.BlockTime/1000000)
maxtime=moment(data.result.AxisX.BlockTime/1000000)
mintime=moment(data.result.AxisX.BlockTime/1000000)
// mintime.add(-(this.state.duration),'seconds').format('YYYY-MM-DD HH:mm:ss')
mintime.subtract(-(this.state.duration),'seconds').format('YYYY-MM-DD HH:mm:ss')
moment(data.result.AxisX.BlockTime/1000000).format('YYYY-MM-DD HH:mm:ss')
}
// console.log(this.state.duration,'dddddd')
// console.log(-(this.state.duration),'ppppppp')
var source= data.result.Rows
var target=[];
for(var i in source){
......@@ -113,6 +111,7 @@ class App extends Component {
}
target.push(list);
}
var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
var option;
......@@ -191,6 +190,24 @@ class App extends Component {
});
});
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)
]
};
}
let datas = [];
let now = new Date(1997, 9, 3);
let oneDay = 24 * 3600 * 1000;
let value = Math.random() * 1000;
for (var i = 0; i < 1000; i++) {
datas.push(randomData());
}
option = {
visualMap: {
show: false,
......@@ -220,8 +237,8 @@ class App extends Component {
})
},
max:timeee.unix()*1000000000,
// max:timeee.add(10,'seconds').unix()*1000000000,
max:maxtime.unix()*1000000000,
// max:maxtime.add(10,'seconds').unix()*1000000000,
min:mintime.unix()*1000000000,
splitNumber:10,
......@@ -229,18 +246,13 @@ class App extends Component {
show:true,
symbol: ['none', 'arrow']
},
// boundaryGap: true,
axisTick: {
alignWithLabel:true,
},
// scrollBar: true
},
// 上边的轴指的是之前block
{
// name:'block',
// data:topValue,
// offset:-75,
axisLine:{
show: true,
symbol: ['none', 'arrow']
......@@ -251,7 +263,6 @@ class App extends Component {
axisTick: {
alignWithLabel:true,
},
// scrollBar: true
},
{
axisLine:{
......@@ -264,7 +275,6 @@ class App extends Component {
axisTick: {
alignWithLabel:true,
},
// scrollBar: true
},
],
yAxis: {
......@@ -295,26 +305,6 @@ class App extends Component {
}
},
dataZoom: [
{
// height:20,
type: "slider",
show: true,
xAxisIndex: [0],
left: '5%',
bottom:-1,
start: 0,
end: 80
},
{
type: "inside", // 支持内部鼠标滚动平移
start: 0,
end: 5,
zoomOnMouseWheel: false, // 关闭滚轮缩放
moveOnMouseWheel: true, // 开启滚轮平移
moveOnMouseMove: true // 鼠标移动能触发数据窗口平移
}
],
toolbox: {
feature: {
dataZoom: {}
......@@ -323,14 +313,13 @@ class App extends Component {
// dataZoom: {
// type: 'inside'
// },
series: series,
};
// console.log(option,'opitons')
myChart.setOption(option);
// window.addEventListener("resize", function () {
// myChart.resize(); //使图表自适应窗口的大小
// });
window.addEventListener("resize", function () {
myChart.resize(); //使图表自适应窗口的大小
})
extension(myChart);
function extension(myChart){
var elementDiv = document.getElementById('extension');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment