<script
>
....
export default {
name
: "LineChart",
...
data
:function () {
return{
series
:[]
}
},
mounted() {
...以下省略部分逻辑
...
let obj
= {
color
:'...',
type
: 'line',
showAllSymbol
: true,
data
: [],
showBackground
: true,
coordinateSystem
: 'cartesian2d',
backgroundStyle
: {
...
},
symbol
:'none',
symbolSize
: 10,
areaStyle
: {
....
},
itemStyle
: {
normal
: {
...
}
}
}
...
for(let j
=0;j
<item
.length
;j
++){
let node
= item
[j
]
if(node
.flag
==' ...此处省略...'){
let mObj
= {
value
:node
.num
,
symbolSize
:10,
symbol
: '',
flag
:node
.flag
}
obj
.data
.push(mObj
)
}else if(node
.flag
==='...此处省略...'){
let mObj
= {
value
:node
.num
,
symbolSize
:10,
symbol
: 'circle',
flag
: node
.flag
}
obj
.data
.push(mObj
)
}else{
let mObj
= {
value
:node
.num
,
symbolSize
:10,
symbol
: 'none',
flag
: node
.flag
}
obj
.data
.push(mObj
)
}
}
this.series
.push(obj
)
},
methods
: {
initEcharts() {
const vm
= this
var myChart
= echarts
.init(this.$refs
.chart
)
myChart
.setOption({
animation
: false,
grid
: {
...
},
xAxis
: {
type
: 'category',
show
: true,
boundaryGap
: true,
maxInterval
: 0.01,
axisLabel
: {
interval
: 0,
textStyle
: {
color
: 'rgb(102,102,102)',
},
formatter
: function(val
){
val
=val
+''
if(val
!==''){
...
}else{
return ''
}
}
},
axisTick
:{
interval
:'auto',
show
:false
},
axisLine
: {
lineStyle
:{
color
: 'rgb(238,238,238)'
}
},
data
:
},
yAxis
: {
type
: 'value',
axisLabel
: {
formatter
: function(){
return "";
}
},
axisTick
:{
show
:false
},
axisLine
: {
show
: false
},
splitLine
:{
show
:true,
lineStyle
:{
color
:'rgb(238,238,238)',
width
:1,
type
:'solid'
}
}
},
dataZoom
:[
...
],
series
: this.series
},true)
},
}
}
</script
>
<style scoped lang
="less">
.line_chart_area
{
width
: 750px
;
margin
: auto
;
margin
-top
: 37px
;
height
: 320px
;
}
</style
>
转载请注明原文地址: https://lol.8miu.com/read-21055.html