| | |
| | | } |
| | | .right-middle-block { |
| | | height: 35%; |
| | | background: #dd35a5; |
| | | } |
| | | .right-bottom-block { |
| | | height: 35%; |
| | |
| | | <div class="bar-chart"> |
| | | <ChartTitle name="车间正品率"></ChartTitle> |
| | | <div class="bar-contents"> |
| | | <div class="bar-total"> |
| | | <div class="bar-item"> |
| | | 当日合计生产:{{ chartData.total }} |
| | | </div> |
| | | <div class="bar-item"> |
| | | 正品率:{{ chartData.rate }} |
| | | </div> |
| | | </div> |
| | | <div class="chart" ref="chart"></div> |
| | | </div> |
| | | </div> |
| | |
| | | props: {}, |
| | | data() { |
| | | return { |
| | | |
| | | chartData:{ |
| | | total:1000, |
| | | rate:'99%', |
| | | datax:['第一车间', '第二车间', '第三车间', '第四车间','第五车间','第六车间',], |
| | | datay:[120, 200, 150, 180, 170, 150, 130,180, 140], |
| | | datay2:[20, 30, 50, 40, 70, 50, 30,80,40], |
| | | } |
| | | }; |
| | | }, |
| | | mounted() { |
| | | let chartData={ |
| | | datax:['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], |
| | | datay:[120, 200, 150, 80, 70, 110, 130] |
| | | } |
| | | this.pieChart('chart',chartData) |
| | | this.pieChart('chart',this.chartData) |
| | | }, |
| | | watch: {}, |
| | | methods: { |
| | |
| | | let chartDom = this.$refs[chartName] |
| | | let myChart = echarts.init(chartDom); |
| | | let option; |
| | | let lineColor='#35ddc74d' |
| | | if(data){ |
| | | option = { |
| | | color:['#618DF8'], |
| | | color:['#dcb018','#00FFFF'], |
| | | tooltip: { |
| | | trigger: 'axis', |
| | | axisPointer: { |
| | | type: 'none' |
| | | }, |
| | | textStyle:{ |
| | | color:'#00FFFF', |
| | | }, |
| | | borderColor:'#00FFFF', |
| | | backgroundColor:'rbga(1,247,253,0.6)', |
| | | formatter:function(a){ |
| | | let list=[] |
| | | let listItem='' |
| | | let firstString='<span style=width:70px;display:inline-block">'+ |
| | | '生产总数'+ |
| | | '</span> '+ |
| | | data.total |
| | | list.push(firstString) |
| | | for(let i in a){ |
| | | let str='<span style=width:70px;display:inline-block">'+ |
| | | a[i].seriesName+ |
| | | '</span> '+ |
| | | a[i].value |
| | | |
| | | list.push(str) |
| | | } |
| | | let lastString='<span style=width:70px;display:inline-block">'+ |
| | | '正品率'+ |
| | | '</span> '+ |
| | | data.rate |
| | | list.push(lastString) |
| | | listItem=list.join('<br>') |
| | | return '<div class="showBox">'+listItem+'</div>' |
| | | } |
| | | }, |
| | | grid: { |
| | | right: "11%", |
| | | bottom:'21%', |
| | | right: "10px", |
| | | bottom:'60px', |
| | | left:'10px', |
| | | top:'10px', |
| | | }, |
| | | dataZoom: [ |
| | | { |
| | |
| | | }, |
| | | ], |
| | | legend: { |
| | | itemWidth: 12, |
| | | itemHeight: 12, |
| | | itemWidth: 8, |
| | | itemHeight: 8, |
| | | itemGap: 35,//间距 |
| | | // data:data.legend?[ |
| | | // { |
| | | // name:data.legend.data[0], |
| | | // icon: 'roundRect', |
| | | // }, |
| | | // ]:[] |
| | | bottom:'5px', |
| | | left:'center', |
| | | data:[ |
| | | { |
| | | name:'正品数量', |
| | | icon:'circle', |
| | | textStyle:{ |
| | | color:'#dcb018' |
| | | } |
| | | }, |
| | | { |
| | | name:'次品数量', |
| | | icon:'circle', |
| | | textStyle:{ |
| | | color:'#00FFFF' |
| | | } |
| | | }, |
| | | ], |
| | | }, |
| | | xAxis: [ |
| | | { |
| | |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color:'#EAEAEA', |
| | | color:lineColor, |
| | | } |
| | | }, |
| | | axisLabel:{ |
| | | rotate:45, |
| | | margin: 12, |
| | | // rotate:45, |
| | | margin: 10, |
| | | show: true, |
| | | textStyle: { |
| | | color: '#9B9B9B' |
| | | color: '#00FFFF' |
| | | }, |
| | | }, |
| | | data: data.datax?data.datax:[], |
| | |
| | | yAxis: [ |
| | | { |
| | | type: '', |
| | | name: 'yyy', |
| | | name: '', |
| | | // min: data.yAxis[0].min?data.yAxis.min:0, |
| | | minInterval: 1,//坐标轴是整数 |
| | | max:Math.ceil(eval(`Math.max(${data.datay})`)/5)*5,//数据最大值加3 |
| | |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color:'#EAEAEA', |
| | | color:lineColor, |
| | | } |
| | | }, |
| | | nameTextStyle:{ |
| | | color:"#9B9B9B", |
| | | color:"#00FFFF", |
| | | }, |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | // 使用深浅的间隔色 |
| | | color: '#EAEAEA', |
| | | color: lineColor, |
| | | } |
| | | }, |
| | | axisTick: { |
| | | show: false |
| | | }, |
| | | axisLabel: { |
| | | textStyle: { |
| | | color: '#9B9B9B' |
| | | }, |
| | | formatter: '' |
| | | } |
| | | }, |
| | | { |
| | | type: '', |
| | | name: '', |
| | | // min: data.yAxis[0].min?data.yAxis.min:0, |
| | | minInterval: 1,//坐标轴是整数 |
| | | max:Math.ceil(eval(`Math.max(${data.datay2})`)/5)*5,//数据最大值加3 |
| | | interval: Math.ceil(eval( `Math.max(${data.datay2})`)/5)*5 / 5, |
| | | position: 'right', |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color:lineColor, |
| | | } |
| | | }, |
| | | nameTextStyle:{ |
| | | color:"#00FFFF", |
| | | }, |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | // 使用深浅的间隔色 |
| | | color:lineColor, |
| | | } |
| | | }, |
| | | axisTick: { |
| | |
| | | ], |
| | | series:[ |
| | | { |
| | | type: '', |
| | | name: 'y', |
| | | type: 'bar', |
| | | name: '正品数量', |
| | | barWidth: '20%', |
| | | itemStyle: { |
| | | normal: { |
| | |
| | | } |
| | | }, |
| | | data: data.datay, |
| | | }, |
| | | { |
| | | type: 'bar', |
| | | name: '次品数量', |
| | | barWidth: '20%', |
| | | itemStyle: { |
| | | normal: { |
| | | //柱形图圆角,初始化效果 |
| | | barBorderRadius:[4, 4, 0, 0], |
| | | } |
| | | }, |
| | | data: data.datay2, |
| | | } |
| | | ] |
| | | }; |
| | |
| | | <style scoped lang="scss"> |
| | | .bar-chart{ |
| | | width:100%; |
| | | height:calc(100% - 10px); |
| | | padding:10px 0 0; |
| | | height:calc(100% - 20px); |
| | | padding:20px 0 0; |
| | | .bar-contents{ |
| | | width:100%; |
| | | height:calc(100% - 60px); |
| | | border:1px solid #00FFFF; |
| | | box-sizing: border-box; |
| | | .bar-total{ |
| | | width:100%; |
| | | height:30px; |
| | | line-height:30px; |
| | | color:#dcb018; |
| | | font-size:14px; |
| | | margin-top:10px; |
| | | .bar-item{ |
| | | width:50%; |
| | | text-align:center; |
| | | float:left; |
| | | } |
| | | } |
| | | .chart{ |
| | | width: 100%; |
| | | height:100%; |
| | | height:calc(100% - 40px); |
| | | } |
| | | } |
| | | } |
| | |
| | | width:100%; |
| | | height:40px; |
| | | margin-bottom:20px; |
| | | font-size:18px; |
| | | font-size:16px; |
| | | color:#00FFFF; |
| | | position:relative; |
| | | .title-left-tip{ |
New file |
| | |
| | | <template> |
| | | <div class="bar-chart"> |
| | | <ChartTitle name="物料需求统计"></ChartTitle> |
| | | <div class="bar-contents"> |
| | | <div class="chart" ref="chart"></div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import ChartTitle from "@/views/cockpitPage/components/ChartTitle.vue"; |
| | | //引入echart |
| | | import * as echarts from 'echarts' |
| | | export default { |
| | | components: { |
| | | ChartTitle, |
| | | }, |
| | | props: {}, |
| | | data() { |
| | | return { |
| | | chartData:{ |
| | | datax:['产品1', '产品2', '产品3', '产品4','产品5', '产品6'], |
| | | datay:[120, 200, 150, 380, 470, 150, 230], |
| | | } |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.pieChart('chart',this.chartData) |
| | | }, |
| | | watch: {}, |
| | | methods: { |
| | | //在职 |
| | | pieChart(chartName,data){ |
| | | let chartDom = this.$refs[chartName] |
| | | let myChart = echarts.init(chartDom); |
| | | let option; |
| | | let lineColor='#35ddc74d' |
| | | if(data){ |
| | | option = { |
| | | color:['#00FFFF','#dcb018'], |
| | | tooltip: { |
| | | trigger: 'axis', |
| | | axisPointer: { |
| | | type: 'none' |
| | | }, |
| | | }, |
| | | grid: { |
| | | right: "80px", |
| | | bottom:'60px', |
| | | left:'60px', |
| | | top:'30px', |
| | | }, |
| | | dataZoom: [ |
| | | { |
| | | type: 'inside', |
| | | // show: true, //显示滚动条 |
| | | start:0, |
| | | end: 100, |
| | | xAxisIndex: 0, |
| | | minSpan:20, |
| | | maxSpan:100, |
| | | // handleSize: 8 |
| | | }, |
| | | { |
| | | // type: 'slider', //两个一个是slider,一个是inside,slider是增加滚动条以及鼠标拖动滚动条功能,inside则是鼠标滚轮滚动滚动条。 |
| | | type: 'inside', |
| | | // show: true, |
| | | // realtime : true, |
| | | xAxisIndex: 0, |
| | | minSpan:20, |
| | | maxSpan:100, |
| | | start: 0, |
| | | end: 100 |
| | | }, |
| | | ], |
| | | legend: { |
| | | itemWidth: 8, |
| | | itemHeight: 8, |
| | | itemGap: 35,//间距 |
| | | bottom:'5px', |
| | | left:'center', |
| | | }, |
| | | yAxis: [ |
| | | { |
| | | type: 'category', |
| | | axisTick: { |
| | | show: false |
| | | }, |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color:lineColor, |
| | | } |
| | | }, |
| | | axisLabel:{ |
| | | // rotate:45, |
| | | margin: 10, |
| | | show: true, |
| | | textStyle: { |
| | | color:function(params,index){ |
| | | let colorList=['#dcb018','#00FFFF'] |
| | | if(index % 2 == 0){ |
| | | return colorList[0] |
| | | }else{ |
| | | return colorList[1] |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | data: data.datax?data.datax:[], |
| | | } |
| | | ], |
| | | xAxis: [ |
| | | { |
| | | type: '', |
| | | name: '单位:件', |
| | | // min: data.yAxis[0].min?data.yAxis.min:0, |
| | | minInterval: 1,//坐标轴是整数 |
| | | max:Math.ceil(eval(`Math.max(${data.datay})`)/5)*5,//数据最大值加3 |
| | | interval: Math.ceil(eval( `Math.max(${data.datay})`)/7)*7 / 7, |
| | | position: 'left', |
| | | axisLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | color:'#0a112B', |
| | | } |
| | | }, |
| | | nameTextStyle:{ |
| | | color:"#00FFFF", |
| | | }, |
| | | splitLine: { |
| | | show: true, |
| | | lineStyle: { |
| | | // 使用深浅的间隔色 |
| | | color: lineColor, |
| | | } |
| | | }, |
| | | axisTick: { |
| | | show: false |
| | | }, |
| | | |
| | | axisLabel: { |
| | | textStyle: { |
| | | color: '#00FFFF' |
| | | }, |
| | | |
| | | } |
| | | }, |
| | | ], |
| | | series:[ |
| | | { |
| | | type: 'bar', |
| | | name: '', |
| | | barWidth: '20%', |
| | | itemStyle: { |
| | | normal: { |
| | | //柱形图圆角,初始化效果 |
| | | barBorderRadius:[4, 4, 0, 0], |
| | | color:function(params){ |
| | | let colorList=['#dcb018','#00FFFF'] |
| | | if(params.dataIndex % 2 == 0){ |
| | | return colorList[0] |
| | | }else{ |
| | | return colorList[1] |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | data: data.datay, |
| | | }, |
| | | ] |
| | | }; |
| | | |
| | | option && myChart.setOption(option); |
| | | }else{ |
| | | option={}; |
| | | myChart.setOption(option,true); |
| | | } |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .bar-chart{ |
| | | width:100%; |
| | | height:calc(100% - 20px); |
| | | padding:20px 0 0; |
| | | .bar-contents{ |
| | | width:100%; |
| | | height:calc(100% - 60px); |
| | | border:1px solid #00FFFF; |
| | | box-sizing: border-box; |
| | | .chart{ |
| | | width: 100%; |
| | | height:100%; |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | <template #leftBlock1> |
| | | <StatisticalBox></StatisticalBox> |
| | | </template> |
| | | <template #rightBlock2> |
| | | <MaterialChart @should-reload="reloadAllData"></MaterialChart> |
| | | </template> |
| | | <template #rightBlock3> |
| | | <BarChart @should-reload="reloadAllData"></BarChart> |
| | | </template> |
| | |
| | | <script> |
| | | import StatisticalBox from "@/views/cockpitPage/components/StatisticalBox"; |
| | | import BackgroundBoardLayout from "@/components/cockpitPage/BackgroundBoardLayout.vue"; |
| | | import MaterialChart from "@/views/cockpitPage/components/MaterialChart.vue"; |
| | | import BarChart from "@/views/cockpitPage/components/BarChart.vue"; |
| | | export default { |
| | | components: { |
| | | StatisticalBox, |
| | | BackgroundBoardLayout, |
| | | MaterialChart, |
| | | BarChart, |
| | | }, |
| | | props: {}, |