Toggle navigation
Toggle navigation
This project
Loading...
Sign in
monitor_v3
/
hg-monitor-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
王涛
3 years ago
Commit
042d0091cd646edaa5fd4fc9483fdae5057c4ac2
1 parent
8e8e4f0f
性能曲线代码迁移到base
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
129 additions
and
0 deletions
hg-monitor-web-base/src/main/resources/static/vue3/src/views/zjdaping/components/lineChart/index.html
hg-monitor-web-base/src/main/resources/static/vue3/src/views/zjdaping/components/lineChart/index.js
hg-monitor-web-base/src/main/resources/static/vue3/src/views/zjdaping/components/lineChart/index.html
0 → 100644
View file @
042d009
<div
:id=
"chartId"
style=
"width:100%;height:100%;"
></div>
...
...
hg-monitor-web-base/src/main/resources/static/vue3/src/views/zjdaping/components/lineChart/index.js
0 → 100644
View file @
042d009
export
default
{
name
:
'lineChart'
,
template
:
''
,
// props:['yAxisData','seriesData','legendData','chartId'],
props
:[
'optionData'
],
components
:
{
},
data
(){
return
{
myChart
:
''
,
titleFontSize
:
30
,
yAxisData
:
''
,
//y序列的数据
seriesData
:[],
//y轴数据
newOptionData
:
this
.
optionData
,
chartId
:
'line-echart'
}
},
watch
:{
optionData
(
newValue
,
oldValue
){
this
.
newOptionData
=
newValue
this
.
chartSetOption
()
}
},
setup
(
props
,
{
attrs
,
slots
,
emit
})
{
const
{
proxy
}
=
Vue
.
getCurrentInstance
();
// 挂载完
Vue
.
onMounted
(()
=>
{
proxy
.
chartSetOption
()
})
const
chartSetOption
=
()
=>
{
const
chartDom
=
proxy
.
$el
const
myChart
=
echarts
.
init
(
chartDom
);
proxy
.
myChart
=
myChart
;
/* window.addEventListener('resize', proxy.screenAdapter)
proxy.screenAdapter()*/
let
option
=
props
.
optionData
;
/* option = {
title: {
text: ''
},
tooltip: {
trigger: 'axis',
backgroundColor:'rgba(50,50,50,0.7)',
borderColor:"#333",
textStyle:{
color:"#fff",
align:'left'
}
},
legend: {
data: props.legendData,
itemHeight:0,//图例圆圈大小设置
y:'7px',
textStyle: {
color: '#ffffff',
fontsize:"12px"
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true,
},
/!*toolbox: {
feature: {
saveAsImage: {}
}
},*!/
xAxis: {
type: 'category',
boundaryGap: false,
data: xAxisData,
axisLine:{
show:false,//是否显示坐标线
},
axisTick: {
show: false //是否显示坐标刻度
},
axisLabel:{
color:'#ffffff',
},
},
yAxis: proxy.yAxisData,
series: proxy.seriesData,
itemStyle:{
showSymbol:false
}
};*/
option
&&
myChart
.
setOption
(
option
,
true
);
}
const
screenAdapter
=
()
=>
{
proxy
.
titleFontSize
=
proxy
.
myChart
.
offsetWidth
/
100
*
3.6
const
adapterOption
=
{
legend
:
{
itemWidth
:
proxy
.
titleFontSize
,
itemHeight
:
proxy
.
titleFontSize
,
itemGap
:
proxy
.
titleFontSize
,
textStyle
:
{
fontSize
:
proxy
.
titleFontSize
/
2
}
}
}
proxy
.
myChart
.
setOption
(
adapterOption
,
true
)
proxy
.
myChart
.
resize
()
}
return
{
chartSetOption
,
screenAdapter
}
},
unmounted
()
{
// window.removeEventListener('resize', this.screenAdapter)
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment