Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
graph
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李伟@五瓣科技
graph
Commits
7b5f56c0
Commit
7b5f56c0
authored
Jul 05, 2022
by
wenli.huang@wuban.net.cn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
newup
parent
34798fcc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
347 additions
and
358 deletions
+347
-358
App.js
src/App.js
+347
-358
No files found.
src/App.js
View file @
7b5f56c0
...
@@ -32,11 +32,11 @@ class App extends Component {
...
@@ -32,11 +32,11 @@ class App extends Component {
})
})
// console.log(data.result.AxisX.BlockTime,'开始')
// console.log(data.result.AxisX.BlockTime,'开始')
var
timee
e
=
moment
(
data
.
result
.
AxisX
.
BlockTime
/
1000000
)
var
maxtim
e
=
moment
(
data
.
result
.
AxisX
.
BlockTime
/
1000000
)
timee
e
.
format
(
'
YYYY-MM-DD HH:mm:ss
'
)
maxtim
e
.
format
(
'
YYYY-MM-DD HH:mm:ss
'
)
timee
e
.
add
(
this
.
state
.
duration
,
'
seconds
'
).
format
(
'
YYYY-MM-DD HH:mm:ss
'
)
maxtim
e
.
add
(
this
.
state
.
duration
,
'
seconds
'
).
format
(
'
YYYY-MM-DD HH:mm:ss
'
)
timee
e
.
unix
()
maxtim
e
.
unix
()
var
mintime
=
moment
(
data
.
result
.
AxisX
.
BlockTime
/
1000000
)
var
mintime
=
moment
(
data
.
result
.
AxisX
.
BlockTime
/
1000000
)
...
@@ -85,15 +85,13 @@ class App extends Component {
...
@@ -85,15 +85,13 @@ class App extends Component {
})
})
if
(
this
.
state
.
duration
<
0
){
if
(
this
.
state
.
duration
<
0
){
timee
e
=
moment
(
data
.
result
.
AxisX
.
BlockTime
/
1000000
)
maxtim
e
=
moment
(
data
.
result
.
AxisX
.
BlockTime
/
1000000
)
mintime
=
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.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
'
)
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
'
)
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
source
=
data
.
result
.
Rows
var
target
=
[];
var
target
=
[];
for
(
var
i
in
source
){
for
(
var
i
in
source
){
...
@@ -113,6 +111,7 @@ class App extends Component {
...
@@ -113,6 +111,7 @@ class App extends Component {
}
}
target
.
push
(
list
);
target
.
push
(
list
);
}
}
var
chartDom
=
document
.
getElementById
(
'
main
'
);
var
chartDom
=
document
.
getElementById
(
'
main
'
);
var
myChart
=
echarts
.
init
(
chartDom
);
var
myChart
=
echarts
.
init
(
chartDom
);
var
option
;
var
option
;
...
@@ -191,6 +190,24 @@ class App extends Component {
...
@@ -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
=
{
option
=
{
visualMap
:
{
visualMap
:
{
show
:
false
,
show
:
false
,
...
@@ -220,8 +237,8 @@ class App extends Component {
...
@@ -220,8 +237,8 @@ class App extends Component {
})
})
},
},
max
:
timee
e
.
unix
()
*
1000000000
,
max
:
maxtim
e
.
unix
()
*
1000000000
,
// max:timee
e.add(10,'seconds').unix()*1000000000,
// max:maxtim
e.add(10,'seconds').unix()*1000000000,
min
:
mintime
.
unix
()
*
1000000000
,
min
:
mintime
.
unix
()
*
1000000000
,
splitNumber
:
10
,
splitNumber
:
10
,
...
@@ -229,18 +246,13 @@ class App extends Component {
...
@@ -229,18 +246,13 @@ class App extends Component {
show
:
true
,
show
:
true
,
symbol
:
[
'
none
'
,
'
arrow
'
]
symbol
:
[
'
none
'
,
'
arrow
'
]
},
},
// boundaryGap: true,
axisTick
:
{
axisTick
:
{
alignWithLabel
:
true
,
alignWithLabel
:
true
,
},
},
// scrollBar: true
},
},
// 上边的轴指的是之前block
// 上边的轴指的是之前block
{
{
// name:'block',
// data:topValue,
// offset:-75,
axisLine
:{
axisLine
:{
show
:
true
,
show
:
true
,
symbol
:
[
'
none
'
,
'
arrow
'
]
symbol
:
[
'
none
'
,
'
arrow
'
]
...
@@ -251,7 +263,6 @@ class App extends Component {
...
@@ -251,7 +263,6 @@ class App extends Component {
axisTick
:
{
axisTick
:
{
alignWithLabel
:
true
,
alignWithLabel
:
true
,
},
},
// scrollBar: true
},
},
{
{
axisLine
:{
axisLine
:{
...
@@ -264,7 +275,6 @@ class App extends Component {
...
@@ -264,7 +275,6 @@ class App extends Component {
axisTick
:
{
axisTick
:
{
alignWithLabel
:
true
,
alignWithLabel
:
true
,
},
},
// scrollBar: true
},
},
],
],
yAxis
:
{
yAxis
:
{
...
@@ -295,26 +305,6 @@ class App extends Component {
...
@@ -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
:
{
toolbox
:
{
feature
:
{
feature
:
{
dataZoom
:
{}
dataZoom
:
{}
...
@@ -323,14 +313,13 @@ class App extends Component {
...
@@ -323,14 +313,13 @@ class App extends Component {
// dataZoom: {
// dataZoom: {
// type: 'inside'
// type: 'inside'
// },
// },
series
:
series
,
series
:
series
,
};
};
// console.log(option,'opitons')
myChart
.
setOption
(
option
);
myChart
.
setOption
(
option
);
// window.addEventListener("resize", function () {
window
.
addEventListener
(
"
resize
"
,
function
()
{
// myChart.resize(); //使图表自适应窗口的大小
myChart
.
resize
();
//使图表自适应窗口的大小
// });
})
extension
(
myChart
);
extension
(
myChart
);
function
extension
(
myChart
){
function
extension
(
myChart
){
var
elementDiv
=
document
.
getElementById
(
'
extension
'
);
var
elementDiv
=
document
.
getElementById
(
'
extension
'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment