var chartDom = document.getElementById("columnBar");
var myChart = echarts.init(chartDom);
var option;
option = {
color: "#288ce1",
xAxis: {
type: "category",
data: [
"机构1",
"机构2",
"机构3",
"机构4",
"机构5",
"机构6",
"机构7",
"机构8",
"机构9",
"机构10",
"机构11",
],
axisLabel: {
interval: 0,
formatter: function (value) {
var str = value.split("");
return str.join("\n");
},
textStyle: {
color: "#b7b7b7",
},
},
},
yAxis: {
type: "value",
show: false,
axisLabel: {
textStyle: {
color: "#b7b7b7",
},
},
},
series: [
{
data: [
120,
200,
150,
80,
70,
110,
130,
120,
200,
150,
80,
70,
110,
130,
],
type: "bar",
showBackground: false,
backgroundStyle: {
color: "rgba(180, 180, 180, 0.2)",
},
markLine: {
silent: true,
symbol:'none',
lineStyle: {
normal: {
color: "red",
},
},
data: [
{
name: "标线1起点",
yAxis: 150,
label: {
formatter: "BBB",
},
},
{
name: "标线1终点",
yAxis: 100,
label: {
formatter: "AAA",
},
},
],
},
label: {
show: true,
rotate: 0,
position: "insideTop",
distance: 15,
verticalAlign: "middle",
textStyle: {
color: "#fff",
fontSize: 12,
},
},
},
],
};
option && myChart.setOption(option);
|