|
@@ -0,0 +1,226 @@
|
|
|
+<template>
|
|
|
+ <!-- 支架压力柱状图 -->
|
|
|
+ <div ref="bar" style="height: 170px; width: 380px"></div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name: "Bars",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ myChart: null,
|
|
|
+ xData: [],
|
|
|
+ yData: [],
|
|
|
+ };
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ const option = {
|
|
|
+ title: {
|
|
|
+ text: "材料损耗",
|
|
|
+ // 标题内边距 上下边距 左右边距
|
|
|
+ padding: [10, 0, 0, 70],
|
|
|
+ textStyle: {
|
|
|
+ fontWeight: "bolder", //标题颜色
|
|
|
+ color: "white",
|
|
|
+ fontSize: 18,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ // show: false,
|
|
|
+ trigger: "axis",
|
|
|
+ axisPointer: {
|
|
|
+ type: "shadow",
|
|
|
+ },
|
|
|
+ formatter: (params) => {
|
|
|
+ let str = "";
|
|
|
+ for (let i = 0; i < params.length; i++) {
|
|
|
+ if (params[i].seriesName !== "") {
|
|
|
+ str +=
|
|
|
+ params[i].name +
|
|
|
+ ":" +
|
|
|
+ params[i].seriesName +
|
|
|
+ params[i].value +
|
|
|
+ "<br/>";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return str;
|
|
|
+ // if (params[0].data > 39) {
|
|
|
+ // return params[0].marker + "压力过高:" + params[0].data;
|
|
|
+ // } else if (params[0].data < 26) {
|
|
|
+ // return params[0].marker + "压力过低:" + params[0].data;
|
|
|
+ // } else {
|
|
|
+ // return params[0].marker + "压力正常:" + params[0].data;
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ color: ["#FF6666", "#99CC66", "#FFFF66"],
|
|
|
+ legend: {
|
|
|
+ show: true,
|
|
|
+ orient: "horizontal",
|
|
|
+ padding: [10, 0, 0, 0],
|
|
|
+ right: 0,
|
|
|
+ icon: "circle",
|
|
|
+ itemGap: 10,
|
|
|
+ itemHeight: 10,
|
|
|
+ textStyle: {
|
|
|
+ color: "#fff",
|
|
|
+ fontSize: 10,
|
|
|
+ padding: [0, 0, 0, -10],
|
|
|
+ },
|
|
|
+ data: ["锚杆消耗", "工字钢消耗", "水泥黄沙消耗"],
|
|
|
+ },
|
|
|
+ grid: {
|
|
|
+ top: "22%",
|
|
|
+ left: "3%",
|
|
|
+ right: "4%",
|
|
|
+ bottom: "3%",
|
|
|
+ containLabel: true,
|
|
|
+ },
|
|
|
+ xAxis: [
|
|
|
+ {
|
|
|
+ type: "category",
|
|
|
+ axisLabel: {
|
|
|
+ color: "#fff",
|
|
|
+ interval: 0,
|
|
|
+ fontSize: 9,
|
|
|
+ },
|
|
|
+ axisLine: {
|
|
|
+ show: true,
|
|
|
+ },
|
|
|
+ data: [
|
|
|
+ "1月",
|
|
|
+ "2月",
|
|
|
+ "3月",
|
|
|
+ "4月",
|
|
|
+ "5月",
|
|
|
+ "6月",
|
|
|
+ "7月",
|
|
|
+ "8月",
|
|
|
+ "9月",
|
|
|
+ "10月",
|
|
|
+ "11月",
|
|
|
+ "12月",
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ yAxis: [
|
|
|
+ {
|
|
|
+ type: "value",
|
|
|
+ name: "万吨",
|
|
|
+ axisLabel: {
|
|
|
+ color: "#fff",
|
|
|
+ // fontSize: 11,
|
|
|
+ },
|
|
|
+ nameTextStyle: {
|
|
|
+ color: "white",
|
|
|
+ padding: [0, 0, 0, -30],
|
|
|
+ },
|
|
|
+ min: 0,
|
|
|
+ max: 200,
|
|
|
+ splitLine: {
|
|
|
+ show: false,
|
|
|
+ lineStyle: {
|
|
|
+ type: "dotted",
|
|
|
+ color: "#fff",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: "锚杆消耗",
|
|
|
+ type: "bar",
|
|
|
+ barWidth: 6,
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: "#93FF93",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: "#34FF34",
|
|
|
+ },
|
|
|
+ ]),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // barWidth: "10",
|
|
|
+ barCategoryGap: "5%",
|
|
|
+ data: [116, 153, 167, 186, 178, 134, 111, 173, 107, 174, 139, 122],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "工字钢消耗",
|
|
|
+ type: "bar",
|
|
|
+ barWidth: 6,
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: "#00FFE3",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: "#4693EC",
|
|
|
+ },
|
|
|
+ ]),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // barWidth: "10",
|
|
|
+ barCategoryGap: "5%",
|
|
|
+ data: [159, 142, 190, 110, 106, 176, 161, 168, 116, 105, 169, 171],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "水泥黄沙消耗",
|
|
|
+ type: "bar",
|
|
|
+ barWidth: 6,
|
|
|
+ itemStyle: {
|
|
|
+ normal: {
|
|
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
+ {
|
|
|
+ offset: 0,
|
|
|
+ color: "#FFEB8E",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ offset: 1,
|
|
|
+ color: "#FFCC23",
|
|
|
+ },
|
|
|
+ ]),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // barWidth: "10",
|
|
|
+ barCategoryGap: "5%",
|
|
|
+ data: [136, 163, 194, 192, 120, 109, 182, 185, 122, 171, 105, 113],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+
|
|
|
+ this.myChart = this.$echarts.init(this.$refs.bar);
|
|
|
+ // 获取数据
|
|
|
+
|
|
|
+ this.myChart.setOption(option);
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="less">
|
|
|
+.main {
|
|
|
+ display: flex;
|
|
|
+}
|
|
|
+.botton1 {
|
|
|
+ margin-top: 20px;
|
|
|
+}
|
|
|
+.botton2 {
|
|
|
+ margin-top: 20px;
|
|
|
+}
|
|
|
+.name {
|
|
|
+ color: #4adefe;
|
|
|
+ font-size: 20px;
|
|
|
+ display: block;
|
|
|
+}
|
|
|
+.value {
|
|
|
+ display: block;
|
|
|
+ color: white;
|
|
|
+}
|
|
|
+</style>
|