import * as echarts from "echarts";
const option = {
xAxis: {
type: "category",
data: [],
axisLabel: {
fontSize: 16,
color: "#000",
},
},
tooltip: {
trigger: "axis",
formatter: function (params) {
let tooltipText = "";
params.forEach((param) => {
tooltipText += `${param.name}: ${param.value}<br>`;
});
return tooltipText;
},
},
yAxis: {
type: "value",
name: "摄入量/g",
nameLocation: "end",
nameGap: 15,
nameTextStyle: {
fontSize: 16,
},
axisLabel: {
fontSize: 16,
},
},
series: [
{
name: "数量",
data: [],
type: "bar",
barWidth: "40",
itemStyle: {
color: "#40B7F1",
borderRadius: [20, 20, 0, 0],
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: "#10E4E5" },
{ offset: 1, color: "#4386FC" },
]),
},
label: {
textStyle: {
fontSize: 14,
color: "#19BEF3",
},
show: true,
position: "top",
formatter: function (params) {
return params.value;
},
},
},
],
};
export default option;