up

parent 4c4bf958
......@@ -17,9 +17,10 @@ class App extends Component {
endText:'',
value:'',
getValue:0,
time:-100,
getTime:-100,
// time:-100,
// getTime:-100,
inputvalue:0,
inputtime:-100,
// blockOld:0,
// endblockOld:0,
// count:0,
......@@ -32,57 +33,96 @@ class App extends Component {
})
}
inputChangeTime=(e)=>{
this.setState({
time:e.target.value,
})
let times=this.refs.inputtime.value;
this.setState({
inputtime:times
})
}
getInputHeight=()=>{
console.log(this.state.inputvalue,'点击获取的value')
// getInputHeight=()=>{
// console.log(this.state.inputvalue,'点击获取的value')
var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
myChart.showLoading()
fetch(`/api/graph_by_height_and_duration?height=${this.state.inputvalue}&duration=${this.state.requestDuration}`,{
method:'GET',
headers:{
'Content-Type':'application/json;charset=UTF-8'
},
})
.then(res =>res.json())
.then((newData) => {
myChart.hideLoading()
let allRows0Arr = []
let allRows1Arr = []
let allRows2Arr = []
let allTopAxisXArr = []
let allBottomAxisXArr = []
let allLinksArr = []
// var chartDom = document.getElementById('main');
// var myChart = echarts.init(chartDom);
// myChart.showLoading()
// fetch(`/api/graph_by_height_and_duration?height=${this.state.inputvalue}&duration=${this.state.requestDuration}`,{
// method:'GET',
// headers:{
// 'Content-Type':'application/json;charset=UTF-8'
// },
// })
// .then(res =>res.json())
// .then((newData) => {
// myChart.hideLoading()
// let allRows0Arr = []
// let allRows1Arr = []
// let allRows2Arr = []
// let allTopAxisXArr = []
// let allBottomAxisXArr = []
// let allLinksArr = []
let {Rows, AxisX, Links } = newData.result
let {TopAxisX, BottomAxisX} = AxisX
allRows0Arr = Rows[0]
allRows1Arr = Rows[1]
allRows2Arr = Rows[2]
allTopAxisXArr = TopAxisX
allBottomAxisXArr = BottomAxisX
allLinksArr = Links
newData.result.Rows[0] = allRows0Arr
newData.result.Rows[1] = allRows1Arr
newData.result.Rows[2] = allRows2Arr
newData.result.AxisX.TopAxisX = allTopAxisXArr
newData.result.AxisX.BottomAxisX = allBottomAxisXArr
newData.result.Links = allLinksArr
this.initChart(newData)
})
// let {Rows, AxisX, Links } = newData.result
// let {TopAxisX, BottomAxisX} = AxisX
// allRows0Arr = Rows[0]
// allRows1Arr = Rows[1]
// allRows2Arr = Rows[2]
// allTopAxisXArr = TopAxisX
// allBottomAxisXArr = BottomAxisX
// allLinksArr = Links
// newData.result.Rows[0] = allRows0Arr
// newData.result.Rows[1] = allRows1Arr
// newData.result.Rows[2] = allRows2Arr
// newData.result.AxisX.TopAxisX = allTopAxisXArr
// newData.result.AxisX.BottomAxisX = allBottomAxisXArr
// newData.result.Links = allLinksArr
// this.initChart(newData)
// })
// }
getInput=()=>{
console.log(this.state.inputtime,'点击获取的time','切换的高度:',this.state.inputvalue)
console.log(typeof(this.state.inputvalue),typeof(this.state.inputtime),'类型')
if(this.state.inputtime == 0 || this.state.inputtime > 0 ){
alert("不可以为0且时间只能为负")
}
else{
var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
myChart.showLoading()
fetch(`/api/graph_by_height_and_duration?height=${this.state.inputvalue}&duration=${this.state.inputtime }`,{
method:'GET',
headers:{
'Content-Type':'application/json;charset=UTF-8'
},
})
.then(res =>res.json())
.then((newData) => {
myChart.hideLoading()
let allRows0Arr = []
let allRows1Arr = []
let allRows2Arr = []
let allTopAxisXArr = []
let allBottomAxisXArr = []
let allLinksArr = []
let {Rows, AxisX, Links } = newData.result
let {TopAxisX, BottomAxisX} = AxisX
allRows0Arr = Rows[0]
allRows1Arr = Rows[1]
allRows2Arr = Rows[2]
allTopAxisXArr = TopAxisX
allBottomAxisXArr = BottomAxisX
allLinksArr = Links
newData.result.Rows[0] = allRows0Arr
newData.result.Rows[1] = allRows1Arr
newData.result.Rows[2] = allRows2Arr
newData.result.AxisX.TopAxisX = allTopAxisXArr
newData.result.AxisX.BottomAxisX = allBottomAxisXArr
newData.result.Links = allLinksArr
this.initChart(newData)
})
}
}
getInputTime=()=>{
this.setState({
getTime:this.state.time
})
console.log(this.state.getTime,'点击获取的time')
}
componentDidMount(){
let that = this
var chartDom = document.getElementById('main');
......@@ -121,8 +161,6 @@ class App extends Component {
allBottomAxisXArr = BottomAxisX
allLinksArr = Links
that.initChart(resData)
console.log(that.state.getValue,'')
console.log(that.state.getTime,'时间')
// if(!that.interval){
// that.interval = setInterval(() => {
// fetch(`/api/graph_by_height_and_duration?height=0&duration=${that.state.requestDuration}`,{
......@@ -154,9 +192,6 @@ class App extends Component {
// }
var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
console.log(that.state.getTime,'时间2')
myChart.on('datazoom', function(params){
clearInterval(that.interval)
var options = myChart.getOption();
......@@ -245,7 +280,7 @@ class App extends Component {
// })
// }
that.setState({
requestDuration:-100,
// requestDuration:-100,
duration:-10,
},()=>{
if(startBlock !=0 ){
......@@ -260,34 +295,70 @@ class App extends Component {
requestDuration:that.state.requestDuration*(that.state.count+1)
})
}
if(that.state.inpttime != -100){
console.log("不为-100")
that.setState({
requestDuration:that.state.inputtime
},()=>{
console.log(that.state.requestDuration,'时间')
fetch(`/api/graph_by_height_and_duration?height=${startBlock}&duration=${that.state.requestDuration}`,{
method:'GET',
headers:{
'Content-Type':'application/json;charset=UTF-8'
},
})
.then(res =>res.json())
.then((newData) => {
myChart.hideLoading()
let {Rows, AxisX, Links } = newData.result
let {TopAxisX, BottomAxisX} = AxisX
allRows0Arr = Rows[0]
allRows1Arr = Rows[1]
allRows2Arr = Rows[2]
allTopAxisXArr = TopAxisX
allBottomAxisXArr = BottomAxisX
allLinksArr = Links
newData.result.Rows[0] = allRows0Arr
newData.result.Rows[1] = allRows1Arr
newData.result.Rows[2] = allRows2Arr
newData.result.AxisX.TopAxisX = allTopAxisXArr
newData.result.AxisX.BottomAxisX = allBottomAxisXArr
newData.result.Links = allLinksArr
that.initChart(newData)
})
})
}
// console.log(that.state.requestDuration,'startrequestDuration')
// console.log(startBlock,'startBlock')
// console.log(that.state.count,'count')
fetch(`/api/graph_by_height_and_duration?height=${startBlock}&duration=${that.state.requestDuration}`,{
method:'GET',
headers:{
'Content-Type':'application/json;charset=UTF-8'
},
})
.then(res =>res.json())
.then((newData) => {
myChart.hideLoading()
let {Rows, AxisX, Links } = newData.result
let {TopAxisX, BottomAxisX} = AxisX
allRows0Arr = Rows[0]
allRows1Arr = Rows[1]
allRows2Arr = Rows[2]
allTopAxisXArr = TopAxisX
allBottomAxisXArr = BottomAxisX
allLinksArr = Links
newData.result.Rows[0] = allRows0Arr
newData.result.Rows[1] = allRows1Arr
newData.result.Rows[2] = allRows2Arr
newData.result.AxisX.TopAxisX = allTopAxisXArr
newData.result.AxisX.BottomAxisX = allBottomAxisXArr
newData.result.Links = allLinksArr
that.initChart(newData)
})
// console.log(that.state.requestDuration,'时间')
// fetch(`/api/graph_by_height_and_duration?height=${startBlock}&duration=${that.state.requestDuration}`,{
// method:'GET',
// headers:{
// 'Content-Type':'application/json;charset=UTF-8'
// },
// })
// .then(res =>res.json())
// .then((newData) => {
// myChart.hideLoading()
// let {Rows, AxisX, Links } = newData.result
// let {TopAxisX, BottomAxisX} = AxisX
// allRows0Arr = Rows[0]
// allRows1Arr = Rows[1]
// allRows2Arr = Rows[2]
// allTopAxisXArr = TopAxisX
// allBottomAxisXArr = BottomAxisX
// allLinksArr = Links
// newData.result.Rows[0] = allRows0Arr
// newData.result.Rows[1] = allRows1Arr
// newData.result.Rows[2] = allRows2Arr
// newData.result.AxisX.TopAxisX = allTopAxisXArr
// newData.result.AxisX.BottomAxisX = allBottomAxisXArr
// newData.result.Links = allLinksArr
// that.initChart(newData)
// })
})
}
......@@ -689,6 +760,7 @@ class App extends Component {
<p>${moment(parseInt(params.data.value[0]/1000000)).format('YYYY-MM-DD HH:mm:ss.SSS')}</p>
<p>round:${params.data.value[4]}</p>
<p>TxCount: ${params.data.value[8]}</p>
<p>Y:${(params.data.value[1]).slice(0,4)}</p>
`
document.querySelector('html').onmousemove = function (event) {
var elementDiv = document.querySelector('#extension')
......@@ -732,17 +804,24 @@ class App extends Component {
const {startText,endText}=this.state
return (
<div>
<div style={{width:'50%',display:'flex',justifyContent:'space-around'}}>
<div>
<input ref="inputvalue" onChange={()=>this.inputChangeValue()} style={{width:'30%',textAlign:'center'}}/>
<button onClick={()=>this.getInputHeight()} style={{cursor:'pointer'}}>点击切换高度</button>
<div style={{width:'60%',display:'flex',justifyContent:'center'}}>
<div>
<span>高度:</span>
<input ref="inputvalue" defaultValue='0' onChange={()=>this.inputChangeValue()} style={{width:'20%',textAlign:'center'}}/>
<span>时间:</span>
<input ref="inputtime" defaultValue='-100' onChange={()=>this.inputChangeTime()} style={{width:'20%',textAlign:'center'}}/>
<button onClick={()=>this.getInput()} style={{cursor:'pointer'}}>点击切换</button>
</div>
{/* <div>
<input value={this.state.time} onChange={this.inputChangeTime} style={{width:'30%',textAlign:'center'}}/>
<button onClick={this.getInputTime} style={{cursor:'pointer'}}>切换时间</button>
<input ref="inputvalue" defaultValue='0' onChange={()=>this.inputChangeValue()} style={{width:'30%',textAlign:'center'}}/>
<button onClick={()=>this.getInputHeight()} style={{cursor:'pointer'}}>切换高度</button>
</div>
<div>
<input ref="inputtime" defaultValue='-100' onChange={()=>this.inputChangeTime()} style={{width:'30%',textAlign:'center'}}/>
<button onClick={()=>this.getInputTime()} style={{cursor:'pointer'}}>切换时间</button>
</div> */}
<div>当前高度:{this.state.getValue}</div>
<div>当前时间:{this.state.requestDuration}</div>
<div>当前高度:{this.state.inputvalue}</div>
<div>当前时间:{this.state.inputtime == -100 ? `${-100}` : this.state.inputtime}</div>
</div>
<div style={{position:'relative'}}>
<div id="main" className="container" style={{position:'relative', padding: '50px', boxSizing:'border-box', width: '100%', height: 900 }}> </div>
......
......@@ -2,12 +2,12 @@ const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function (app) {
app.use(createProxyMiddleware('/api',
{
"target":'http://15.161.127.241:30001',
// "target":'http://15.161.127.241:30001',
// "target": "http://54.168.125.67:26657",
// "target": "http://3.9.177.160:50080",
// "target":'http://52.221.177.10:30181',
"target":'http://52.221.177.10:30181',
"changeOrigin": true,
"pathRewrite": {
"^/api": "/"
......
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