123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- <template>
- <div>
- <Echart
- :options="options"
- id="bottomRightChart"
- height="480px"
- width="913px"
- ></Echart>
- </div>
- </template>
- <script>
- import Echart from '@/common/echart'
- export default {
- data() {
- return {
- options: {},
- // 定义颜色
- colorList: {
- linearYtoG: {
- type: 'linear',
- x: 0,
- y: 0,
- x2: 1,
- y2: 1,
- colorStops: [
- {
- offset: 0,
- color: '#f5b44d'
- },
- {
- offset: 1,
- color: '#28f8de'
- }
- ]
- },
- linearGtoB: {
- type: 'linear',
- x: 0,
- y: 0,
- x2: 1,
- y2: 0,
- colorStops: [
- {
- offset: 0,
- color: '#43dfa2'
- },
- {
- offset: 1,
- color: '#28f8de'
- }
- ]
- },
- linearBtoG: {
- type: 'linear',
- x: 0,
- y: 0,
- x2: 1,
- y2: 0,
- colorStops: [
- {
- offset: 0,
- color: '#1c98e8'
- },
- {
- offset: 1,
- color: '#28f8de'
- }
- ]
- },
- areaBtoG: {
- type: 'linear',
- x: 0,
- y: 0,
- x2: 0,
- y2: 1,
- colorStops: [
- {
- offset: 0,
- color: 'rgba(35,184,210,.2)'
- },
- {
- offset: 1,
- color: 'rgba(35,184,210,0)'
- }
- ]
- }
- }
- }
- },
- components: {
- Echart
- },
- props: {
- cdata: {
- type: Object,
- default: () => ({})
- }
- },
- watch: {
- cdata: {
- handler(newData) {
- this.options = {
- title: {
- text: '',
- textStyle: {
- color: '#D3D6DD',
- fontSize: 24,
- fontWeight: 'normal'
- },
- subtext: newData.year + '/' + newData.nowdate,
- subtextStyle: {
- color: '#fff',
- fontSize: 18
- },
- top: 50,
- left: 80
- },
- legend: {
- top: 120,
- left: 80,
- orient: 'vertical',
- itemGap: 15,
- itemWidth: 14,
- itemHeight: 14,
- data: ['实际','平均'],
- textStyle: {
- color: '#fff',
- fontSize: 16
- }
- },
- tooltip: {
- trigger: 'item'
- },
- radar: {
- center: ['68%', '27%'],
- radius: '40%',
- name: {
- color: '#fff',
- fontSize:16
- },
- splitNumber: 8,
- axisLine: {
- lineStyle: {
- color: this.colorList.linearYtoG,
- opacity: 0.6
- }
- },
- splitLine: {
- lineStyle: {
- color: this.colorList.linearYtoG,
- opacity: 0.6
- }
- },
- splitArea: {
- areaStyle: {
- color: '#fff',
- opacity: 0.1,
- shadowBlur: 25,
- shadowColor: '#000',
- shadowOffsetX: 0,
- shadowOffsetY: 5
- }
- },
- indicator: [
- {
- name: '来料不良',
- max: 100
- },
- {
- name: '制程不良',
- max: 100
- },
- {
- name: '设计不良',
- max: 100
- },
- {
- name: '其他',
- max: 100
- }
- ]
- },
- grid: {
- left: 90,
- right: 80,
- bottom: 40,
- top: '60%'
- },
- xAxis: {
- type: 'category',
- position: 'bottom',
- axisLine: true,
- axisLabel: {
- color: 'rgba(255,255,255,.8)',
- fontSize: 15
- },
- data: newData.weekCategory
- },
- // 下方Y轴
- yAxis: {
- name: '',
- nameLocation: 'end',
- nameGap: 24,
- nameTextStyle: {
- color: 'rgba(255,255,255,.5)',
- fontSize: 14
- },
- max:newData.maxData,
- //splitNumber: 4,
- min:newData.minData,
- axisLine: {
- lineStyle: {
- opacity: 0
- }
- },
- splitLine: {
- show: true,
- lineStyle: {
- color: '#fff',
- opacity: 0.1
- }
- },
- axisLabel: {
- color: 'rgba(255,255,255,.8)',
- fontSize: 14
- }
- },
- series: [
- {
- name: '',
- type: 'radar',
- symbolSize: 0,
- data: [
- {
- value: newData.radarDataAvg,
- name: '平均',
- itemStyle: {
- normal: {
- color: '#f8d351'
- }
- },
- lineStyle: {
- normal: {
- opacity: 0
- }
- },
- areaStyle: {
- normal: {
- color: '#f8d351',
- shadowBlur: 25,
- shadowColor: 'rgba(248,211,81,.3)',
- shadowOffsetX: 0,
- shadowOffsetY: -10,
- opacity: 1
- }
- }
- },
- {
- value: newData.radarData,
- name: '实际',
- itemStyle: {
- normal: {
- color: '#43dfa2'
- }
- },
- lineStyle: {
- normal: {
- opacity: 0
- }
- },
- areaStyle: {
- normal: {
- color: this.colorList.linearGtoB,
- shadowBlur: 15,
- shadowColor: 'rgba(0,0,0,.2)',
- shadowOffsetX: 0,
- shadowOffsetY: 5,
- opacity: 0.8
- }
- }
- }
- ]
- },
- {
- name: '',
- type: 'line',
- smooth: true,
- symbol: 'emptyCircle',
- symbolSize: 8,
- itemStyle: {
- normal: {
- color: '#fff'
- }
- },
- lineStyle: {
- normal: {
- color: this.colorList.linearBtoG,
- width: 3
- }
- },
- areaStyle: {
- normal: {
- color: this.colorList.areaBtoG
- }
- },
- data: newData.weekLineData,
- label: {
- show: true,
- position: 'top',
- fontSize:14,
- },
- lineSmooth: true,
- markLine: {
- silent: true,
- data: [
- {yAxis: newData.goalData}
- /*{
- type: 'average',
- value:80,
- name: '平均值'
- }*/
- ],
- precision: 0,
- label: {
- normal: {
- formatter: '目标线%: \n {c}'
- }
- },
- lineStyle: {
- normal: {
- fontSize: 16,
- color: 'rgba(248,211,81,.7)'
- }
- }
- },
- tooltip: {
- position: 'top',
- formatter: '{c} %',
- backgroundColor: 'rgba(28,152,232,.2)',
- padding: 6
- }
- },
- {
- name: '占位背景',
- type: 'bar',
- itemStyle: {
- normal: {
- show: true,
- color: '#000',
- opacity: 0
- }
- },
- silent: true,
- barWidth: '50%',
- data: newData.weekMaxData,
- animation: false
- }
- ]
- }
- },
- immediate: true,
- deep: true
- }
- }
- }
- </script>
|