//圖表方法
drawLine(xData,sData) {
let myChart = echarts.init(document.getElementById("chart"));
let option = {
//color: ['rgba(68, 222, 192, 1)'],//柱狀圖顏色
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
},
legend: {},
grid: {
top: "0%",
left: "1%",
right: "2%",
bottom: "1%",
containLabel: true,
},
xAxis: {
show: false,
type: "value",
boundaryGap: [0, 0.01],
axisLine: { show: false },
axisTick: { show: false }, //刻度
splitLine: { show: false }, //網格
},
yAxis: {
type: "category",
data: xData,
axisLine: { show: false },
axisTick: { show: false },
splitLine: { show: false },
axisLabel: {
textStyle: {
color: "rgba(84, 106, 135, 1)",
},
},
},
series: [
{
type: "bar",
barWidth: "14", //設置寬度
itemStyle: { normal: { color: "rgba(68, 222, 192, 1)" } }, //柱狀圖顏色
showBackground: true,
backgroundStyle: {//設置柱狀圖背景顏色
color: "#fff",
},
data: sData,
},
],
};
myChart.setOption(option);
window.addEventListener("resize", function () {
myChart.resize();
});