X轴旋转
Page({
getChart2Option: function (chartData) {
var option = {
color: ['#3E92EF'],
tooltip: {},
grid: {
top: "5%",
left: '3%',
right: '3%',
bottom: '3%',
containLabel: true
},
xAxis: {
data: chartData.xData,
type: 'category',
axisTick: {
show: false
},
boundaryGap: [0, 0.1],
**//x轴旋转**
axisLabel: {
interval: 0, //隔几项显示一个标签
rotate: "45" //标签倾斜的角度,旋转的角度是-90到90度
}
},
yAxis: {
type: 'value',
boundaryGap: [0, 0.2],
},
series: [{
data: chartData.seriesData,
type: 'bar',
barWidth: 20,
label: {
normal: {
show: true,
position: 'top',
fontSize: 10,
}
},
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(
0, 0, 0, 1,
[{
offset: 0.5,
color: '#3F90EF'
},
{
offset: 0.9,
color: '#00D0E6'
},
]
)
}
},
}]
};
return option
},
});