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

//散点图
export default function pointOption(data=[],dName = [],dx = []) {
return {
legend: {
icon: 'rectangle', //data图标样式
itemWidth: 10, //data图标大小
itemHeight: 10,
left: 15,
textStyle: {
fontSize: 8,
fontWeight: 400
},
data: dName
},
grid: {
// left: '8%',
top: 30
},
tooltip: {
trigger: 'axis',
backgroundColor: "#08182F",
color: "#fff",
borderColor: "#3373CC",
textStyle: {
color: "#fff", //设置文字颜色
fontSize: 9
},
extraCssText: "box-shadow: 0px 0px 10px 0px #3373CC;",
confine: true
},
xAxis: {
data: dx,
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;
}
}
if(value.length > 9) {
if(isCont == true) {
str = value.substring(10, 16)
} else {
str = value.substring(5, 10)
}
}
return str;
}
}
},
yAxis: {},
series: [
{
name: '新车上市',
data: data[0],
type: 'scatter',
symbolSize: function (data) {
return data[0];
},
emphasis: {
focus: 'series',
label: {
show: true,
formatter: function ( param ) { return param.data[3] },
position: 'top'
}
},
itemStyle: {
color: '#FF4852'
}
},
{
name: '车展',
data: data[1],
type: 'scatter',
symbolSize: function (data) {
return data[1];
},
emphasis: {
focus: 'series',
label: {
show: true,
formatter: function (param) { return param.data[3] },
position: 'top'
}
},
itemStyle: {
color: '#FF6E25'
}
}
]
}
}