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
725537e8
Commit
725537e8
authored
Jul 04, 2022
by
wenli.huang@wuban.net.cn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up
parent
668f91cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
7 deletions
+31
-7
App.js
src/App.js
+31
-7
No files found.
src/App.js
View file @
725537e8
...
...
@@ -10,9 +10,10 @@ class App extends Component {
AxisY
:[],
Links
:[],
target
:[],
duration
:
-
10
}
componentDidMount
(){
fetch
(
'
/api/graph_by_height_and_duration?height=1&duration=10
'
,{
fetch
(
`/api/graph_by_height_and_duration?height=100&duration=
${
this
.
state
.
duration
}
`
,{
method
:
'
GET
'
,
headers
:{
'
Content-Type
'
:
'
application/json;charset=UTF-8
'
...
...
@@ -29,6 +30,17 @@ class App extends Component {
AxisY
:
data
.
result
.
AxisY
,
Links
:
data
.
result
.
Links
,
})
// 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
'
)
timeee
.
unix
()
var
mintime
=
moment
(
data
.
result
.
AxisX
.
BlockTime
/
1000000
)
// console.log(mintime,'mintime')
// console.log(mintime.unix()*1000000000,'最小值')
var
markline
=
data
.
result
.
AxisX
.
TopAxisX
.
map
(
item
=>
{
return
[
...
...
@@ -73,8 +85,15 @@ class App extends Component {
]
)
})
if
(
this
.
state
.
duration
<
0
){
timeee
=
moment
(
data
.
result
.
AxisX
.
BlockTime
/
1000000
)
mintime
=
moment
(
data
.
result
.
AxisX
.
BlockTime
/
1000000
)
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
){
...
...
@@ -94,7 +113,6 @@ class App extends Component {
}
target
.
push
(
list
);
}
var
chartDom
=
document
.
getElementById
(
'
main
'
);
var
myChart
=
echarts
.
init
(
chartDom
);
var
option
;
...
...
@@ -196,12 +214,14 @@ class App extends Component {
name
:
'
Time
'
,
axisLabel
:
{
formatter
:
(
function
(
value
){
return
moment
(
parseInt
(
value
/
1000000
)).
format
(
'
YYYY-MM-DD HH:mm:ss.SSS
'
)
// console.log(value,'value')
return
moment
(
parseInt
(
value
/
1000000
)).
format
(
'
YYYY-MM-DD HH:mm:ss
'
)
})
},
min
:
data
.
result
.
AxisX
.
AxisXBegin
,
max
:
data
.
result
.
AxisX
.
AxisXEnd
,
interval
:(
data
.
result
.
AxisX
.
AxisXEnd
-
data
.
result
.
AxisX
.
AxisXBegin
)
/
5
,
max
:
timeee
.
unix
()
*
1000000000
,
min
:
mintime
.
unix
()
*
1000000000
,
splitNumber
:
10
,
axisLine
:{
show
:
true
,
symbol
:
[
'
none
'
,
'
arrow
'
]
...
...
@@ -280,7 +300,11 @@ class App extends Component {
// },
series
:
series
,
};
console
.
log
(
option
,
'
opitons
'
)
myChart
.
setOption
(
option
);
// window.addEventListener("resize", function () {
// myChart.resize(); //使图表自适应窗口的大小
// });
extension
(
myChart
);
function
extension
(
myChart
){
...
...
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