配置项如下
/*
问题是:
如何显示隐藏的 X轴为2017-09的数据2
*/
option ={
"tooltip": {
"trigger": "axis",
"backgroundColor": "rgba(0,0,0,0.5)",
"padding": 10,
"axisPointer": {
"type": "cross",
"label": {
"backgroundColor": "#6a7985"
}
}
},
"grid": {
"width": "auto",
"bottom": 25,
"top": "20%",
"x2": "100"
},
"legend": {
"top": 0,
"padding": 1,
"data": [
{
"name": "院校专区",
"textStyle": {
"color": "#35dca3"
}
}
]
},
"xAxis": [
{
"type": "category",
"name": "预计成交时间",
"nameTextStyle": {
"color": "#555555"
},
triggerEvent:true,
"boundaryGap": true,
"data": [
"2017-06",
"2017-09",
"2017-11"
],
"splitLine": {
"show": false
},
"axisLine": {
"lineStyle": {
"color": "rgba(230,234,236,0.3)"
}
},
"axisTick": {
"lineStyle": {
"color": "#e6eaec"
}
},
"axisLabel": {
"interval": 1,
"textStyle": {
"color": "#555555"
}
}
}
],
"yAxis": [
{
"type": "value",
"name": "项目数",
"axisLine": {
"lineStyle": {
"color": "#e6eaec"
}
},
"nameTextStyle": {
"color": "#555555"
},
"axisTick": {
"lineStyle": {
"color": "#e6eaec"
}
},
"axisLabel": {
"textStyle": {
"color": "#555555"
}
}
}
],
"series": [
{
"xAxisIndex": 0,
"name": "院校专区",
"type": "line",
"stack": "总量",
"areaStyle": {
"normal": {
"color": "#35dca3",
"opacity": 0.5
}
},
"itemStyle": {
"normal": {
"label": {
"show": true,
"position": "top",
"textStyle": {
"color": "#35dca3",
"baseline": "middle"
}
},
"color": "#35dca3"
}
},
"data": [
1,
1,
9
]
},
{
"xAxisIndex": 0,
"name": "院校专区",
"type": "line",
"stack": "总量",
"areaStyle": {
"normal": {
"color": "#35dca3",
"opacity": 0.5
}
},
"itemStyle": {
"normal": {
"label": {
"show": true,
"position": "top",
"textStyle": {
"color": "#35dca3",
"baseline": "middle"
}
},
"color": "#35dca3"
}
},
"data": [
2,
4,
9
]
}
]
}
myChart.on("click", function (param){
console.log(param)
});