update chart settings

This commit is contained in:
DESKTOP-FUDKNA8\znjsz
2024-01-18 15:55:42 +08:00
parent eac23b3408
commit b48f3a713c
4 changed files with 293 additions and 52 deletions

View File

@@ -0,0 +1,56 @@
export const options = {
grid: {
top: "10%",
bottom: "5%",
left: "3%",
right: "5%",
containLabel: true,
},
xAxis: {
max: 100,
axisLabel: {
fontSize: 22,
},
},
yAxis: {
type: "category",
data: ["A组", "B组", "C组"],
inverse: true,
animationDuration: 300,
animationDurationUpdate: 300,
max: 2, // only the largest 3 bars will be displayed
axisLabel: {
fontSize: 22,
},
},
series: [
{
realtimeSort: true,
name: "X",
type: "bar",
data: [10, 20, 30],
label: {
show: true,
position: "right",
valueAnimation: true,
formatter: "{c}%",
color: "rgba(255, 255, 255, 1)",
fontWeight: "bold",
fontSize: 22,
},
},
],
legend: {
show: false,
},
animationDuration: 0,
animationDurationUpdate: 3000,
animationEasing: "linear",
animationEasingUpdate: "linear",
};
export default function setup(echartInstance, dataArr) {
const new_options = { ...options };
new_options.series[0].data = dataArr;
echartInstance.setOption(new_options);
}