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.

110 lines
2.9 KiB

//散点图
import {
doStr
} from "./text"
export default function multiColumnsOption(dx = [], dValue = [], dName = [],color2 = []) {
const newData = [];
for (let i = 0; i < dValue.length; i++) {
let obj = {
name: dName[i],
type: 'bar',
stack: 'total',
barWidth:24,
emphasis: {
focus: 'series'
},
itemStyle: {
normal: {
color: color2[i],
lineStyle: {
color: color2[i]
}
}
},
data: dValue[i]
};
newData.push(obj)
};
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,
axisPointer: {
// Use axis to trigger tooltip
type: 'line' // 'shadow' as default; can also be 'line' or 'shadow'
},
},
legend: {
icon: 'rectangle', //data图标样式
itemWidth: 10, //data图标大小
itemHeight: 10,
left: 15,
right: 15,
itemGap: 10,
textStyle: {
fontSize: 9,
fontWeight: 400
},
},
//图表位置
grid: {
left: 20,
right: 30,
bottom: 20,
top: 50,
containLabel: true
},
xAxis: {
type: 'category',
data: dx,
axisTick: {
show: false //去除刻度线
},
axisLabel: {
interval: 1,
textStyle: {
fontSize: 8
},
formatter: (value) => {
let res = doStr(value, 4)
return res
},
}
},
yAxis: {
type: 'value',
axisLabel: {
color: '#999999', //y轴文本颜色
textStyle: {
fontSize: 9
},
formatter: (value) => {
if (value >= 10000) {
value = (value / 10000) + '万';
}
return value;
}
},
},
series: newData
// series: [
// {
// name: 'Direct',
// type: 'bar',
// stack: 'total',
// emphasis: {
// focus: 'series'
// },
// data: [320, 302, 301, 334, 390, 330, 320]
// },
// ]
}
}