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.

133 lines
3.9 KiB

3 years ago
// 多折线
export default function brokenLines(dName = [], dValue = [], dColor = [], dx = []) {
3 years ago
return {
tooltip: {
trigger: "axis",
backgroundColor: "#08182F",
color: "#fff",
borderColor: "#3373CC",
textStyle: {
color: "#fff", //设置文字颜色
fontSize: 9
},
extraCssText: "box-shadow: 0px 0px 10px 0px #3373CC;",
confine: true,
3 years ago
},
3 years ago
legend: {
icon: 'rectangle', //data图标样式
3 years ago
itemWidth: 10, //data图标大小
itemHeight: 10,
left: 15,
3 years ago
textStyle: {
fontSize: 8,
fontWeight: 400
},
// data: ['微博', '其他','短视频', '微信','APP', '论坛', '新闻'],
data: dName
// color:['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF'],
}, //图表位置
grid: {
left: 7,
right: 7,
bottom: 7,
3 years ago
top: 45,
3 years ago
containLabel: true
3 years ago
},
3 years ago
yAxis: [{
type: 'value',
axisTick: {
show: false //去除刻度线
},
axisLine: {
show: false //去除轴线
},
axisLabel: {
color: '#999999', //y轴文本颜色
textStyle: {
fontSize: 9
},
formatter: (value) => {
if (value >= 10000) {
value = (value / 10000) + '万';
}
return value;
}
},
splitLine: { //分割线
// lineStyle:{
// // color:"#2d3436"
3 years ago
3 years ago
// }
show: true,
lineStyle: {
type: 'dashed',
color: '#E8E8E8',
}
3 years ago
}
3 years ago
}],
xAxis: [{
type: 'category',
// data: ['00:00', '04:00', '08:00', '12:00', '16:00', '20:00', '24:00'],
data: dx,
axisTick: {
show: false //去除刻度线
},
axisLine: {
show: false, //去除轴线
},
axisLabel: {
color: '#999999', //x轴文本颜色
textStyle: {
fontSize: 9
},
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(value.length==7){
return str
}
if (isCont == true) {
str = value.substring(10, 16)
} else {
str = value.substring(5, 10)
}
return str;
}
3 years ago
3 years ago
}
}],
series: Multiple(dName, dValue, dColor)
}
3 years ago
}
3 years ago
3 years ago
function Multiple(dName = [], dValue = [], dColor = []) {
3 years ago
// MS true为单fales为双
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]
}
}
}
})
}
return list;
3 years ago
}