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.
129 lines
3.0 KiB
129 lines
3.0 KiB
// 多折线
|
|
export default function brokenLines(dName = [], dValue = [], dColor = [], dx = []) {
|
|
return {
|
|
tooltip: {
|
|
trigger: "axis",
|
|
backgroundColor: "#08182F",
|
|
color: "#fff",
|
|
borderColor: "#3373CC",
|
|
textStyle: {
|
|
color: "#fff", //设置文字颜色
|
|
},
|
|
extraCssText: "box-shadow: 0px 0px 10px 0px #3373CC;",
|
|
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
|
|
},
|
|
formatter: (value) => {
|
|
if (value >= 10000) {
|
|
value = (value / 10000) + '万';
|
|
}
|
|
return value;
|
|
}
|
|
},
|
|
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'],
|
|
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 (isCont == true) {
|
|
str = value.substring(10, 16)
|
|
} else {
|
|
str = value.substring(5, 10)
|
|
}
|
|
return str;
|
|
}
|
|
|
|
}
|
|
}],
|
|
series: Multiple(dName, dValue, dColor)
|
|
}
|
|
}
|
|
|
|
function Multiple(dName = [], dValue = [], dColor = []) {
|
|
// MS true为单fales为双
|
|
let list = []
|
|
for (let i = 0; i < dName.length; i++) {
|
|
// const element = array[index];
|
|
|
|
list.push({
|
|
name: dName[i],
|
|
type: 'line',
|
|
symbol: 'none', //去圆点
|
|
data: dValue[i],
|
|
itemStyle: {
|
|
normal: {
|
|
color: dColor[i],
|
|
lineStyle: {
|
|
color: dColor[i]
|
|
}
|
|
}
|
|
}
|
|
})
|
|
}
|
|
return list;
|
|
} |