60 lines
1.0 KiB
JavaScript
60 lines
1.0 KiB
JavaScript
export const options = {
|
|
color: ['#a4c9d1', '#72340b', '#ffd601' ],
|
|
grid: {
|
|
top: 8,
|
|
bottom: 20,
|
|
left: 42,
|
|
right: 28,
|
|
},
|
|
legend: {
|
|
show: false,
|
|
},
|
|
xAxis: {
|
|
max: 100,
|
|
splitLine: {
|
|
lineStyle: {
|
|
color: "#fff2",
|
|
},
|
|
},
|
|
axisLabel: {
|
|
fontSize: 16,
|
|
color: "#e5e5e5a3",
|
|
},
|
|
},
|
|
yAxis: {
|
|
type: "category",
|
|
data: ["A组", "B组", "C组"],
|
|
inverse: true,
|
|
max: 2, // only the largest 3 bars will be displayed
|
|
axisLabel: {
|
|
fontSize: 16,
|
|
color: "#e5e5e5a3",
|
|
},
|
|
splitLine: {
|
|
lineStyle: {
|
|
color: "#e5e5e5",
|
|
},
|
|
},
|
|
},
|
|
series: [
|
|
{
|
|
type: "bar",
|
|
data: [34, 2, 23],
|
|
label: {
|
|
show: true,
|
|
position: "right",
|
|
formatter: "{c}%",
|
|
color: "#fff",
|
|
fontSize: 16,
|
|
},
|
|
},
|
|
],
|
|
|
|
};
|
|
|
|
export default function setup(echartInstance, dataArr) {
|
|
const new_options = { ...options };
|
|
new_options.series[0].data = dataArr;
|
|
echartInstance.setOption(new_options);
|
|
}
|