chenzhou/src/components/datapage/LatestWeekYieldOptions.js
DESKTOP-FUDKNA8\znjsz 53ead47882 1
2024-01-30 17:00:44 +08:00

69 lines
1.3 KiB
JavaScript

const d = new Date();
const m = d.getMonth() + 1;
export const options = {
legend: {
textStyle: {
color: "#fff8",
},
},
tooltip: {},
dataset: {
source: [
["date", "钢1线", "钢2线", "钢3线"],
[m + "-" + 1, 0, 0, 0],
[m + "-" + 2, 0, 0, 0],
[m + "-" + 3, 0, 0, 0],
[m + "-" + 4, 0, 0, 0],
[m + "-" + 5, 0, 0, 0],
],
},
grid: {
top: 56,
bottom: 12,
left: 20,
right: 20,
containLabel: true,
},
xAxis: {
type: "category",
axisLabel: {
fontSize: 16,
color: "#fff8",
},
},
yAxis: {
name: "片",
nameTextStyle: {
color: "#fff8",
fontSize: 18,
},
axisLabel: {
fontSize: 18,
color: "#fff8",
},
splitLine: {
lineStyle: {
color: "#fff8",
},
},
minInterval: 1,
},
series: [{ type: "bar" }, { type: "bar" }, { type: "bar" }],
};
export default function setup(
echartInstance,
list = [
["1-12", 1, 2, 3],
["1-13", 4, 5, 6],
["1-14", 14, 15, 16],
["1-15", 9],
["1-16", 4, 5, 6],
["1-17", 1, 1, 1],
]
) {
const new_options = { ...options };
new_options.dataset.source = [["date", "钢1线", "钢2线", "钢3线"], ...list];
echartInstance.setOption(new_options);
}