You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
3.3 KiB

3 years ago
// 折线
export default function brokenLine(dName=[],dValue=[] ,dColor=[],dx=[]){
3 years ago
return{
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'line' // 默认为直线,可选为:'line' | 'shadow'
},
confine: true
},
legend: {
icon: 'rectangle',//data图标样式
itemWidth: 8,//data图标大小
itemHeight: 8,
left: 5,
textStyle: {
fontSize: 8,
fontWeight: 400
},
// data: ['微博', '其他','短视频', '微信','APP', '论坛', '新闻'],
data:dName
// color:['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF'],
}, //图表位置
grid: {
left: 7,
right: 7,
bottom: 7,
top: 36,
containLabel: true
},
yAxis: [
{
type: 'value',
axisTick:{
show:false //去除刻度线
},
axisLine:{
show:false //去除轴线
},
axisLabel: {
color: '#999999',//y轴文本颜色
textStyle: {
fontSize : 9
3 years ago
},
formatter:(value) => {
if(value >= 10000){
value = (value / 10000) + '万';
}
return value;
}
3 years ago
},
splitLine: { //分割线
// lineStyle:{
// // color:"#2d3436"
// }
show: true,
lineStyle: {
type: 'dashed',
color: '#E8E8E8',
}
}
}
],
xAxis: [
{
type: 'category',
// data: ['00:00', '04:00', '08:00', '12:00', '16:00', '20:00', '24:00'],
3 years ago
data:dx,
3 years ago
axisTick:{
show:false //去除刻度线
},
axisLine:{
show:false, //去除轴线
},
axisLabel: {
color: '#999999',//x轴文本颜色
textStyle: {
fontSize : 9
3 years ago
},
formatter: (value) => {
let rex = "00:00:00";
let isCont = false;
let str = value;
for(let i = 0;i<dx.length-1;i++){
//连续两条带小时
if(dx[i].indexOf(rex) === -1 && dx[i+1].indexOf(rex) === -1){
isCont = true;
break;
}
}
if(isCont == true) {
str = value.substring(10, 16)
} else {
str = value.substring(5, 10)
}
return str;
}
3 years ago
}
}
],
series:Multiple(dName,dValue,dColor)
}
}
3 years ago
function Multiple(dName=[],dValue=[], dColor=[]) {
// MS true为单fales为双
3 years ago
let list=[]
for (let i = 0; i < dName.length; i++) {
// const element = array[index];
3 years ago
3 years ago
list.push({
name: dName[i],
type: 'line',
symbol:'none', //去圆点
data: dValue[i],
itemStyle: {
normal:{
color: dColor[i],
lineStyle: {
color: dColor[i]
}
}
}
3 years ago
})
3 years ago
}
return list;
}