let barData = [{name:'name1',age:'18',sex:'0'}];
var barOption = {
title: {
text: 'echarts图标title',
},
legend: {
show: false,
},
grid: {
x: "3.5%", ;
},
color: ["#35D2FF"],
tooltip: {
trigger: "item",
backgroundColor: "rgba(43,43,43,1)",
borderRadius: 4,
borderWidth: 1,
padding: 10,
extraCssText:
"width:199px!important;height:114px;background:rgba(255,255,255,0.94);box-shadow:0px 10px 35px 0px rgba(9,26,66,0.2);border:none;border-radius:20px;display:flex;flex-direction: column;justify-content: space-between;padding:0;margin:0",
formatter: function(params) {
let name = name,
age = age,
sex = sex;
return `
<div><em> ${name}</em> </div>
<div><em>${num}岁</em> </div>
<div>性别<em>${sex}</em></div> `;
},
textStyle: {
color: "rgba(0,0,0,0.45)",
},
},
dataset: {
dimensions: ["dept_name", "num", "percentage", "dept"],
source: [...barData],
},
xAxis: {
type: "category",
axisLine: {
lineStyle: {
color: "#F3F3F3",
},
},
axisLabel: {
textStyle: {
color: "#3B4042",
fontSize: 14,
fontWeight: 400,
},
rotate: 300,
interval: 0,
},
offset: 5,
},
grid:{
y2:100
},
yAxis: {
min: 0,
minInterval: 1,
axisLine: {
lineStyle: {
color: "#FFF",
},
},
axisLabel: {
textStyle: {
color: "#3B4042",
},
},
splitLine: {
show: true,
lineStyle: {
color: "#F3F3F3",
width: 1,
},
},
},
series: [
{
type: "bar",
barMaxWidth: 10,
itemStyle: {
normal: { barBorderRadius: [15] },
},
},
],
};
myBarChart.setOption(barOption, true);
