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.

98 lines
2.9 KiB

3 years ago
//散点图
3 years ago
export default function pointOption(data=[],dName = [],dx = []) {
3 years ago
return {
legend: {
3 years ago
icon: 'rectangle', //data图标样式
itemWidth: 10, //data图标大小
itemHeight: 10,
3 years ago
left: 15,
3 years ago
textStyle: {
3 years ago
fontSize: 8,
3 years ago
fontWeight: 400
},
3 years ago
data: dName
},
grid: {
// left: '8%',
3 years ago
top: 30
3 years ago
},
3 years ago
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
xAxis: {
data: dx,
3 years ago
axisLabel: {
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;
}
3 years ago
}
3 years ago
if(value.length > 9) {
if(isCont == true) {
str = value.substring(10, 16)
} else {
str = value.substring(5, 10)
}
3 years ago
}
3 years ago
return str;
3 years ago
}
}
},
3 years ago
yAxis: {},
series: [
{
3 years ago
name: '新车上市',
3 years ago
data: data[0],
type: 'scatter',
symbolSize: function (data) {
return data[0];
},
emphasis: {
focus: 'series',
label: {
show: true,
3 years ago
formatter: function ( param ) { return param.data[3] },
3 years ago
position: 'top'
}
},
itemStyle: {
color: '#FF4852'
}
},
{
3 years ago
name: '车展',
3 years ago
data: data[1],
type: 'scatter',
symbolSize: function (data) {
return data[1];
},
emphasis: {
focus: 'series',
label: {
show: true,
3 years ago
formatter: function (param) { return param.data[3] },
3 years ago
position: 'top'
}
},
itemStyle: {
color: '#FF6E25'
}
}
]
}
}