当前位置: 代码迷 >> 综合 >> echarts x 轴文本旋转
  详细解决方案

echarts x 轴文本旋转

热度:48   发布时间:2023-11-18 14:37:34.0

 效果图

let xAxisList = []let abarbeitung = []let abarbeitungComplete = []let data = this.problemlList['problemEventTypeList']console.log(data)data.forEach(i=>{xAxisList.push(i.eventTypeName)abarbeitung.push(i.abarbeitung)abarbeitungComplete.push(i.abarbeitungComplete)})console.log(xAxisList)var myChart = echarts.init(document.querySelector(el));// 指定图表的配置项和数据var  option = {tooltip: {trigger: 'axis',axisPointer: {            // 坐标轴指示器,坐标轴触发有效type: 'shadow'        // 默认为直线,可选为:'line' | 'shadow'}},legend: {data: ['整改', '已整改'],itemWidth: 10,textStyle: {color: '#FFFFFF',fontSize: 10}},grid: {left: '3%',right: '4%',bottom: '3%',containLabel: true},xAxis: [{type: 'category',data: xAxisList,axisLabel: {fontSize: 12,color: '#d1f9fb',rotate:40, // 文本旋转角度},}],yAxis: [{name: '单位: 个数',type: 'value',nameTextStyle: {fontSize: 12,color: '#ffffff',},}],series: [{name: '整改',barWidth: 20,type: 'bar',emphasis: {focus: 'series',},data: abarbeitung},{name: '已整改',barWidth: 20,type: 'bar',emphasis: {focus: 'series'},data: abarbeitungComplete},]};myChart.setOption(option);

 

  相关解决方案