Echats相关操作
1.柱状图上显示数字
series: [{
name: '人数',
type: 'bar',
data: [], //x轴对应列的值
itemStyle: { //上方显示数值
normal: {
label: {
show: true, //开启显示
position: 'top', //在上方显示
textStyle: { //数值样式
color: 'black',
fontSize: 16
}
}
}
}
}]
2.柱状图横坐标的字体竖着显示
xAxis : {
axisLabel:{
interval: 0,
formatter: function (value) {
//x轴的文字改为竖版显示
var str = value.split("");
return str.join("\n");
}
},
}
3.柱状图横坐标的字体倾斜45°显示
xAixs : {
// x轴文字倾斜
// x轴文字倾斜
axisLabel:{
interval:0,
rotate:45,//倾斜度 -90 至 90 默认为0
margin:2,
textStyle:{
fontWeight:"bolder",
color:"#000000"
}
}
}
4.柱状图 改变颜色
var option= {
color:['#98d87d','#ffd86e'],
title: {
text: 'xx统计',
subtext: ''
}
}
5.echarts 中x轴转为竖着显示 显示不全的处理
y2 即控制x轴类目的高度的参数 遂将grid加入option
var option= {
grid:{
x2:140,
y2:150
},
}