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.
|
|
|
// 单柱状
|
|
|
|
export default function histogram(dx=[],ds=[],data=[],color1='',direction=true) {
|
|
|
|
// direction true为垂直 false为水平
|
|
|
|
return {
|
|
|
|
tooltip: {
|
|
|
|
trigger: 'axis',
|
|
|
|
axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
|
|
|
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
|
|
|
},
|
|
|
|
confine: true
|
|
|
|
},
|
|
|
|
legend: {
|
|
|
|
x:'15',
|
|
|
|
icon: 'rectangle',//data图标样式
|
|
|
|
itemWidth: '10',//data图标大小
|
|
|
|
itemHeight: '10',
|
|
|
|
textStyle: {
|
|
|
|
fontSize: '9'
|
|
|
|
},
|
|
|
|
data: data,
|
|
|
|
},
|
|
|
|
//图表位置
|
|
|
|
grid: {
|
|
|
|
left: 20,
|
|
|
|
right: 20,
|
|
|
|
bottom: 10,
|
|
|
|
top: 20,
|
|
|
|
containLabel: true
|
|
|
|
},
|
|
|
|
xAxis: direction?[
|
|
|
|
{
|
|
|
|
type: 'category',
|
|
|
|
data: dx,
|
|
|
|
axisTick:{
|
|
|
|
show:false //去除刻度线
|
|
|
|
},
|
|
|
|
axisLine:{
|
|
|
|
show:false, //去除轴线
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
color: '#999999',//x轴文本颜色
|
|
|
|
textStyle: {
|
|
|
|
fontSize : 9
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]:[
|
|
|
|
{
|
|
|
|
type: 'value',
|
|
|
|
axisTick:{
|
|
|
|
show:false //去除刻度线
|
|
|
|
},
|
|
|
|
axisLine:{
|
|
|
|
show:false //去除轴线
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
color: '#999999',//y轴文本颜色
|
|
|
|
textStyle: {
|
|
|
|
fontSize : 9
|
|
|
|
}
|
|
|
|
},
|
|
|
|
splitLine: { //分割线
|
|
|
|
// lineStyle:{
|
|
|
|
// // color:"#2d3436"
|
|
|
|
// }
|
|
|
|
show: true,
|
|
|
|
lineStyle: {
|
|
|
|
type: 'dashed',
|
|
|
|
color: '#E8E8E8',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
yAxis:direction?[
|
|
|
|
{
|
|
|
|
type: 'value',
|
|
|
|
axisTick:{
|
|
|
|
show:false //去除刻度线
|
|
|
|
},
|
|
|
|
axisLine:{
|
|
|
|
show:false //去除轴线
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
color: '#999999',//y轴文本颜色
|
|
|
|
textStyle: {
|
|
|
|
fontSize : 9
|
|
|
|
}
|
|
|
|
},
|
|
|
|
splitLine: { //分割线
|
|
|
|
// lineStyle:{
|
|
|
|
// // color:"#2d3436"
|
|
|
|
|
|
|
|
// }
|
|
|
|
show: true,
|
|
|
|
lineStyle: {
|
|
|
|
type: 'dashed',
|
|
|
|
color: '#E8E8E8',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]:[
|
|
|
|
{
|
|
|
|
type: 'category',
|
|
|
|
data: dx,
|
|
|
|
axisTick:{
|
|
|
|
show:false //去除刻度线
|
|
|
|
},
|
|
|
|
axisLine:{
|
|
|
|
show:false, //去除轴线
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
color: '#999999',//x轴文本颜色
|
|
|
|
textStyle: {
|
|
|
|
fontSize : 9
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
series:{
|
|
|
|
type: 'bar',
|
|
|
|
data: ds,
|
|
|
|
stack:"Search Engine",
|
|
|
|
emphasis: {//折线图的高亮状态。
|
|
|
|
focus: "series",//聚焦当前高亮的数据所在的系列的所有图形。
|
|
|
|
},
|
|
|
|
itemStyle: {
|
|
|
|
normal:{
|
|
|
|
color: color1,
|
|
|
|
// lineStyle: {
|
|
|
|
// color: color1
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// function columar(data=[],ds=[],color1=''){
|
|
|
|
// // MS判断多条数据还是单条数据 true为单条false为多条
|
|
|
|
// let list=[]
|
|
|
|
// for (let i = 0; i < 1; i++) {
|
|
|
|
// list.push({
|
|
|
|
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// return list
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|