64 lines
1.1 KiB
JavaScript
64 lines
1.1 KiB
JavaScript
|
export const options = {
|
||
|
grid: {
|
||
|
top: 10,
|
||
|
bottom: 0,
|
||
|
left: 12,
|
||
|
right: 10,
|
||
|
containLabel: true,
|
||
|
},
|
||
|
xAxis: {
|
||
|
type: "category",
|
||
|
data: [],
|
||
|
axisLabel: {
|
||
|
fontSize: 16,
|
||
|
color: '#fff8'
|
||
|
},
|
||
|
axisLine: {
|
||
|
show: true,
|
||
|
lineStyle: {
|
||
|
color: "#e6e6e633",
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
yAxis: {
|
||
|
type: "value",
|
||
|
axisLine: {
|
||
|
show: true,
|
||
|
lineStyle: {
|
||
|
color: "#e6e6e633",
|
||
|
},
|
||
|
},
|
||
|
splitLine: {
|
||
|
lineStyle: {
|
||
|
color: '#e6e6e633'
|
||
|
}
|
||
|
},
|
||
|
axisLabel: {
|
||
|
fontSize: 16,
|
||
|
color: '#fff8'
|
||
|
},
|
||
|
minInterval: 1,
|
||
|
max: 100,
|
||
|
min: 1
|
||
|
},
|
||
|
series: [
|
||
|
{
|
||
|
data: [],
|
||
|
// data: Array.from({ length: 7 }, () => Math.random() * 100),
|
||
|
type: "bar",
|
||
|
// barWidth: 20,
|
||
|
showBackground: true,
|
||
|
backgroundStyle: {
|
||
|
color: "rgba(180, 180, 180, 0.2)",
|
||
|
},
|
||
|
},
|
||
|
],
|
||
|
};
|
||
|
|
||
|
export default function setup(echartInstance, timeArr, dataArr) {
|
||
|
const new_options = { ...options };
|
||
|
new_options.xAxis.data = timeArr;
|
||
|
new_options.series[0].data = dataArr;
|
||
|
echartInstance.setOption(new_options);
|
||
|
}
|