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.
96 lines
2.5 KiB
96 lines
2.5 KiB
//散点图
|
|
import {doStr} from "./text"
|
|
export default function multiColumnsOption(dx=[], dValue=[], dName=[]) {
|
|
const newData = [];
|
|
for(let i=0;i<dValue.length;i++) {
|
|
let obj = {
|
|
name: dName[i],
|
|
type: 'bar',
|
|
stack: 'total',
|
|
emphasis: {
|
|
focus: 'series'
|
|
},
|
|
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: 8, //data图标大小
|
|
itemHeight: 8,
|
|
left: 5,
|
|
textStyle: {
|
|
fontSize: 8,
|
|
fontWeight: 400
|
|
},
|
|
},
|
|
//图表位置
|
|
grid: {
|
|
left: 50,
|
|
right: 30,
|
|
bottom: 30,
|
|
top: 50,
|
|
},
|
|
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]
|
|
// },
|
|
// ]
|
|
}
|
|
} |