Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
super-hive-web
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
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SuperHive
front-end
super-hive-web
Commits
85ab5e5c
Commit
85ab5e5c
authored
Aug 21, 2020
by
wends
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add chart components
parent
c867add1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
405 additions
and
0 deletions
+405
-0
FFtLine.vue
src/components/Charts/FFtLine.vue
+122
-0
FunctionLine.vue
src/components/Charts/FunctionLine.vue
+152
-0
TimeDomainLine.vue
src/components/Charts/TimeDomainLine.vue
+131
-0
No files found.
src/components/Charts/FFtLine.vue
0 → 100644
View file @
85ab5e5c
<
template
>
<div
:id=
"id"
:class=
"className"
:style=
"
{height:height,minWidth:width}" />
</
template
>
<
script
>
import
echarts
from
'
echarts
'
import
resize
from
'
./mixins/resize
'
export
default
{
mixins
:
[
resize
],
props
:
{
className
:
{
type
:
String
,
default
:
'
chart
'
},
id
:
{
type
:
String
,
default
:
'
chart
'
},
title
:
{
type
:
String
,
default
:
'
line
'
},
width
:
{
type
:
String
,
default
:
'
500px
'
},
height
:
{
type
:
String
,
default
:
'
400px
'
},
lineData
:
{
type
:
Object
,
default
:
()
=>
{
return
{
xAxis
:
[],
series
:
[]
}
}
},
description
:
{
type
:
String
,
default
:
''
},
config
:
{
type
:
Object
,
default
:
()
=>
{
return
{}
}
},
format
:
{
type
:
String
,
default
:
'
HH:mm:ss
'
},
step
:
{
type
:
Boolean
,
default
:
false
}
},
data
()
{
return
{
chart
:
null
}
},
watch
:
{
lineData
:
function
(
val
)
{
this
.
updateChart
(
val
)
}
},
mounted
()
{
this
.
initChart
()
},
beforeDestroy
()
{
if
(
!
this
.
chart
)
{
return
}
this
.
chart
.
dispose
()
this
.
chart
=
null
},
methods
:
{
updateChart
(
data
)
{
this
.
chart
.
setOption
({
xAxis
:
{
data
:
data
.
xAxis
},
series
:
[{
type
:
'
line
'
,
data
:
data
.
series
}]
})
},
initChart
()
{
this
.
chart
=
echarts
.
init
(
document
.
getElementById
(
this
.
id
))
let
config
=
{
tooltip
:
{
show
:
true
},
xAxis
:
{
name
:
'
频率
'
,
type
:
'
category
'
,
data
:
this
.
lineData
.
xAxis
},
yAxis
:
{
name
:
'
幅度
'
,
type
:
'
value
'
},
series
:
[{
type
:
'
line
'
,
showAllSymbol
:
'
auto
'
,
data
:
this
.
lineData
.
series
}]
}
config
=
{
...
config
,
...
this
.
config
}
this
.
chart
.
setOption
(
config
)
}
}
}
</
script
>
src/components/Charts/FunctionLine.vue
0 → 100644
View file @
85ab5e5c
<
template
>
<div
:id=
"id"
:class=
"className"
:style=
"
{height:height,minWidth:width}" />
</
template
>
<
script
>
import
echarts
from
'
echarts
'
import
resize
from
'
./mixins/resize
'
export
default
{
mixins
:
[
resize
],
props
:
{
className
:
{
type
:
String
,
default
:
'
chart
'
},
id
:
{
type
:
String
,
default
:
'
chart
'
},
title
:
{
type
:
String
,
default
:
'
line
'
},
width
:
{
type
:
String
,
default
:
'
500px
'
},
height
:
{
type
:
String
,
default
:
'
400px
'
},
lineData
:
{
type
:
Array
,
default
:
()
=>
{
return
[]
}
},
description
:
{
type
:
String
,
default
:
''
},
config
:
{
type
:
Object
,
default
:
()
=>
{
return
{}
}
},
format
:
{
type
:
String
,
default
:
'
HH:mm:ss
'
},
step
:
{
type
:
Boolean
,
default
:
false
}
},
data
()
{
return
{
chart
:
null
}
},
watch
:
{
lineData
:
function
(
val
)
{
this
.
updateChart
(
val
)
}
},
mounted
()
{
this
.
initChart
()
},
beforeDestroy
()
{
if
(
!
this
.
chart
)
{
return
}
this
.
chart
.
dispose
()
this
.
chart
=
null
},
methods
:
{
updateChart
(
data
)
{
console
.
log
(
data
)
const
xAxis
=
[]
const
series
=
[]
data
.
forEach
(
v
=>
{
xAxis
.
push
(
v
[
0
])
series
.
push
(
v
[
1
])
})
this
.
chart
.
setOption
({
xAxis
:
{
data
:
xAxis
},
series
:
[{
type
:
'
line
'
,
showSymbol
:
false
,
clip
:
true
,
data
:
series
}]
})
},
initChart
()
{
this
.
chart
=
echarts
.
init
(
document
.
getElementById
(
this
.
id
))
let
config
=
{
tooltip
:
{},
xAxis
:
{
name
:
'
x
'
,
minorTick
:
{
show
:
true
},
splitLine
:
{
lineStyle
:
{
color
:
'
#999
'
}
},
minorSplitLine
:
{
show
:
true
,
lineStyle
:
{
color
:
'
#ddd
'
}
}
},
yAxis
:
{
name
:
'
y
'
,
minorTick
:
{
show
:
true
},
splitLine
:
{
lineStyle
:
{
color
:
'
#999
'
}
},
minorSplitLine
:
{
show
:
true
,
lineStyle
:
{
color
:
'
#ddd
'
}
}
},
series
:
[{
type
:
'
line
'
,
showSymbol
:
false
,
clip
:
true
,
data
:
this
.
lineData
}]
}
config
=
{
...
config
,
...
this
.
config
}
this
.
chart
.
setOption
(
config
)
}
}
}
</
script
>
src/components/Charts/TimeDomainLine.vue
0 → 100644
View file @
85ab5e5c
<
template
>
<div
:id=
"id"
:class=
"className"
:style=
"
{height:height,minWidth:width}" />
</
template
>
<
script
>
import
echarts
from
'
echarts
'
import
resize
from
'
./mixins/resize
'
export
default
{
mixins
:
[
resize
],
props
:
{
className
:
{
type
:
String
,
default
:
'
chart
'
},
id
:
{
type
:
String
,
default
:
'
chart
'
},
title
:
{
type
:
String
,
default
:
'
line
'
},
width
:
{
type
:
String
,
default
:
'
500px
'
},
height
:
{
type
:
String
,
default
:
'
400px
'
},
lineData
:
{
type
:
Object
,
default
:
()
=>
{
return
{
xAxis
:
[],
series
:
[]
}
}
},
description
:
{
type
:
String
,
default
:
''
},
config
:
{
type
:
Object
,
default
:
()
=>
{
return
{}
}
},
format
:
{
type
:
String
,
default
:
'
HH:mm:ss
'
},
step
:
{
type
:
Boolean
,
default
:
false
}
},
data
()
{
return
{
chart
:
null
}
},
watch
:
{
lineData
:
function
(
val
)
{
this
.
updateChart
(
val
)
}
},
mounted
()
{
this
.
initChart
()
},
beforeDestroy
()
{
if
(
!
this
.
chart
)
{
return
}
this
.
chart
.
dispose
()
this
.
chart
=
null
},
methods
:
{
updateChart
(
data
)
{
this
.
chart
.
setOption
({
xAxis
:
{
data
:
data
.
xAxis
},
series
:
[{
type
:
'
line
'
,
showSymbol
:
false
,
clip
:
true
,
data
:
data
.
series
.
map
(
v
=>
this
.
strip
(
v
))
}]
})
},
strip
(
num
,
precision
=
12
)
{
return
+
parseFloat
(
num
.
toPrecision
(
precision
))
},
initChart
()
{
function
strip
(
num
,
precision
=
12
)
{
return
+
parseFloat
(
num
.
toPrecision
(
precision
))
}
const
lineData
=
{
xAxis
:
[],
series
:
[]
}
for
(
let
i
=
0
;
i
<
1
;
i
+=
0.001
)
{
const
number
=
strip
(
i
)
lineData
.
xAxis
.
push
(
number
)
lineData
.
series
.
push
(
Math
.
sin
(
2
*
Math
.
PI
*
number
))
}
this
.
chart
=
echarts
.
init
(
document
.
getElementById
(
this
.
id
))
let
config
=
{
tooltip
:
{},
xAxis
:
{
data
:
[]
},
yAxis
:
{},
series
:
[{
type
:
'
line
'
,
data
:
[]
}]
}
config
=
{
...
config
,
...
this
.
config
}
this
.
chart
.
setOption
(
config
)
}
}
}
</
script
>
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