| | |
| | | <template> |
| | | <div> |
| | | <div class="box-container" id="echarts5" style="width: 100%;height:230px"></div> |
| | | <div |
| | | class="box-container" |
| | | id="echarts5" |
| | | style="width: 100%; height: 230px" |
| | | ></div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import * as echarts from "echarts"; |
| | | import {zhu} from './img/t.js' |
| | | import { zhu } from "./img/t.js"; |
| | | |
| | | export default { |
| | | props: { |
| | |
| | | option: {}, |
| | | myChart: {}, |
| | | timechartes: null, |
| | | |
| | | myChart2: null, |
| | | textureImg: null, |
| | | // img, |
| | |
| | | yData2 = [], |
| | | yData3 = []; |
| | | val.forEach((item) => { |
| | | console.log('ceshi', item.completionNum); |
| | | console.log("ceshi", item.completionNum); |
| | | xData.push(item.month); |
| | | yData1.push({ |
| | | value: item.completionNum, |
| | | // value: item.completionNum, |
| | | value: 100, |
| | | symbolRepeat: false, |
| | | }); //实际 |
| | | // yData1.push(item.completionNum); //实际 |
| | | yData2.push(item.planCompletionRate); //planCompletionRate |
| | | yData3.push(item.planCompletionNum); //计划 |
| | | var num = 0; //已完成数 / 计划完成数 |
| | | if (item.completionNum > 0) { |
| | | if (item.planCompletionNum > item.completionNum) { |
| | | // 5/10 |
| | | num = item.completionNum / item.planCompletionNum; |
| | | } else if (item.planCompletionNum <= 0) { |
| | | // 10/0 |
| | | num = 100; |
| | | } else if (item.completionNum >= item.planCompletionNum) { |
| | | // 10/5 |
| | | num = 100; |
| | | } |
| | | } |
| | | yData2.push(num.toFixed(2)); //planCompletionRate |
| | | // yData2.push(item.planCompletionRate); //planCompletionRate |
| | | // yData3.push(item.planCompletionNum); //计划 |
| | | }); |
| | | this.$set(this.option.xAxis, "data", xData); |
| | | this.$set(this.option.series[0], "data", yData1); |
| | |
| | | trigger: "axis", |
| | | formatter: |
| | | "{b0}月<br />" + |
| | | '<a style="display:inline-block;width:10px;height:10px;background:linear-gradient(to bottom,#13e5f2,#01afba);border-radius:50%"></a> {a0}: {c0}<br />' + |
| | | // '<a style="display:inline-block;width:10px;height:10px;background:linear-gradient(to bottom,#13e5f2,#01afba);border-radius:50%"></a> {a0}: {c0}<br />' + |
| | | // '<a style="display:inline-block;width:10px;height:10px;background:linear-gradient(to bottom,#ffc107,#fd7e14);border-radius:50%"></a> {a2}: {c2}<br />' + |
| | | '<a style="display:inline-block;width:10px;height:10px;background:linear-gradient(to bottom,#fff,#eee);border-radius:50%"></a> {a1}: {c1}%<br />', // 添加生产计划数提示 |
| | | backgroundColor: "rgba(0,0,0,0.7)", |
| | |
| | | axisLine: { |
| | | lineStyle: { |
| | | color: "#326e92", |
| | | |
| | | }, |
| | | }, |
| | | }, |
| | |
| | | show: true, |
| | | margin: 5, |
| | | color: "#326e92", |
| | | // formatter: '{value}%' |
| | | formatter: "{value}%", |
| | | }, |
| | | alignTicks: false, |
| | | nameTextStyle: { |
| | |
| | | name: "生产完成数", |
| | | type: "pictorialBar", |
| | | // type: "bar", |
| | | symbol: 'image://'+zhu, |
| | | symbol: "image://" + zhu, |
| | | data: [], |
| | | |
| | | // yAxisIndex: 0, |
| | | // color: { |
| | | // type: "linear", |
| | |
| | | name: "生产完成率", |
| | | type: "line", |
| | | data: [], |
| | | z: 5, |
| | | showSymbol: true, |
| | | yAxisIndex: 1, |
| | | smooth: true, // 使折线图平滑 |
| | | color: "rgba(255,205,86,0.85)", |
| | | color: "#ff9600", |
| | | lineStyle: { |
| | | width: 1, |
| | | }, |
| | |
| | | // window.addEventListener("resize", ()=> { |
| | | // this.myChart.resize(); |
| | | // }); |
| | | |
| | | // this.init() |
| | | }, |
| | | methods: { |
| | |
| | | var chartDom = document.getElementById("main"); |
| | | var myChart = echarts.init(chartDom); |
| | | var option; |
| | | var rocket ='' |
| | | var rocket = ""; |
| | | |
| | | option = { |
| | | legend: { |
| | |
| | | { |
| | | type: "pictorialBar", |
| | | name: "tu1", |
| | | symbol: 'image://'+zhu, |
| | | symbol: "image://" + zhu, |
| | | data: [ |
| | | { |
| | | value: 60, |
| | |
| | | }; |
| | | myChart.setOption(option); |
| | | }, |
| | | |
| | | }, |
| | | }; |
| | | </script> |