diff --git a/src/components/TeamChartDay.vue b/src/components/TeamChartDay.vue index 51308aa..8538d20 100644 --- a/src/components/TeamChartDay.vue +++ b/src/components/TeamChartDay.vue @@ -1,39 +1,47 @@ diff --git a/src/components/TeamChartDayOptions.js b/src/components/TeamChartDayOptions.js new file mode 100644 index 0000000..081ee47 --- /dev/null +++ b/src/components/TeamChartDayOptions.js @@ -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); +} diff --git a/src/components/TeamChartMonth.vue b/src/components/TeamChartMonth.vue index 31ab7d7..ec84704 100644 --- a/src/components/TeamChartMonth.vue +++ b/src/components/TeamChartMonth.vue @@ -1,39 +1,47 @@ diff --git a/src/components/TeamChartMonthOptions.js b/src/components/TeamChartMonthOptions.js new file mode 100644 index 0000000..2f95ef4 --- /dev/null +++ b/src/components/TeamChartMonthOptions.js @@ -0,0 +1,169 @@ +export const options = { + grid: { + top: "10%", + bottom: "10%", + }, + title: [ + { + text: "当前产量:" + 100 + " 片", + left: "27%", + textAlign: "center", + top: "67%", + textStyle: { + fontSize: 12, + }, + }, + { + text: "目标产量:" + 100 + " 片", + left: "27%", + textAlign: "center", + top: "82%", + textStyle: { + fontSize: 12, + }, + }, + { + text: "当前成品率:" + 22 + "%", + left: "73%", + textAlign: "center", + top: "67%", + textStyle: { + fontSize: 12, + }, + }, + { + text: "目标成品率:" + 22 + "%", + left: "73%", + textAlign: "center", + top: "82%", + textStyle: { + fontSize: 12, + }, + }, + ], + series: [ + { + type: "gauge", + startAngle: 90, + center: ["27%", "35%"], + endAngle: -270, + radius: "55%", + progress: { + show: true, + width: 12, + }, + axisLine: { + lineStyle: { + width: 12, + }, + }, + pointer: { + show: false, + }, + axisTick: { + show: false, + }, + splitLine: { + show: false, + }, + axisLabel: { + show: false, + }, + detail: { + valueAnimation: true, + fontSize: 12, + offsetCenter: [0, "0%"], + formatter: "{value}%", + color: "rgba(255, 255, 255, 1)", + }, + data: [ + { + // value: (nowProduction / targetProduction * 100).toFixed(1), + value: 100, + }, + ], + }, + { + type: "gauge", + startAngle: 90, + center: ["73%", "35%"], + endAngle: -270, + radius: "55%", + progress: { + show: true, + width: 12, + }, + axisLine: { + lineStyle: { + width: 12, + }, + }, + pointer: { + show: false, + }, + axisTick: { + show: false, + }, + splitLine: { + show: false, + }, + axisLabel: { + show: false, + }, + detail: { + show: true, + valueAnimation: true, + fontSize: 12, + offsetCenter: [0, "0%"], + formatter: 0 + "%", + // formatter: (nowYield / targetYield * 100).toFixed(1) + '%', + color: "rgba(255, 255, 255, 1)", + }, + data: [ + { + // value: targetYield, + value: 100, + name: "Perfect", + title: { + show: false, + }, + detail: { + show: false, + valueAnimation: true, + offsetCenter: ["0%", "-20%"], + }, + }, + { + value: 100, + // value: nowYield, + name: "Good", + title: { + show: false, + }, + detail: { + show: false, + valueAnimation: true, + offsetCenter: ["0%", "10%"], + }, + }, + { + value: 0, + detail: { + show: true, + }, + }, + ], + }, + ], +}; +export default function setup(echartInstance, data) { + const new_options = { ...options }; + new_options.title[0].text = "当前产量:" + data.nowProduction + " 片"; + new_options.title[1].text = "目标产量:" + data.targetProduction + " 片"; + new_options.title[2].text = "当前成品率:" + data.nowYield + "%"; + new_options.title[3].text = "目标成品率:" + data.targetYield + "%"; + new_options.series[0].data[0].value = (data.nowProduction / data.targetProduction * 100).toFixed(1) + new_options.series[1].data[0].value = data.targetYield + new_options.series[1].data[1].value = data.nowYield + echartInstance.setOption(new_options); +}