2022-11-07 08:45:49 +08:00
|
|
|
<template>
|
2022-11-07 17:08:05 +08:00
|
|
|
<techy-box style="width: 100%; height: calc(100% - 36px); padding: calc(100vmin / 1920 * 16)">
|
|
|
|
<!-- <div :id="id" ref="techy-line-chart" class="techy-chart" /> -->
|
|
|
|
|
|
|
|
<new-bar
|
|
|
|
chart-name="realtime-cost-production"
|
|
|
|
:name-list="['A', 'B', 'C', 'D', 'E', 'F']"
|
|
|
|
:data-list="[
|
|
|
|
{
|
|
|
|
topColor: 'rgba(59, 76, 118, 0.2)',
|
|
|
|
bottomColor: '#49FBD6',
|
|
|
|
name: '产量',
|
|
|
|
data: [64, 91, 55, 65, 37, 77]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
topColor: 'rgba(59, 76, 118, 0.2)',
|
|
|
|
bottomColor: '#31A2FF',
|
|
|
|
name: '能耗',
|
|
|
|
data: [32, 65, 65, 54, 37, 77]
|
|
|
|
}
|
|
|
|
]"
|
|
|
|
/>
|
|
|
|
</techy-box>
|
2022-11-07 08:45:49 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import echarts from 'echarts'
|
2022-11-07 17:08:05 +08:00
|
|
|
import TechyBox from './TechyBox.vue'
|
|
|
|
import newBar from './newBar.vue'
|
2022-11-07 08:45:49 +08:00
|
|
|
import resize from '@/views/OperationalOverview/components/mixins/resize'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'RealtimeProductionHorizontalBarChart',
|
2022-11-07 17:08:05 +08:00
|
|
|
components: { TechyBox, newBar },
|
2022-11-07 08:45:49 +08:00
|
|
|
mixins: [resize],
|
|
|
|
props: {
|
|
|
|
id: {
|
|
|
|
type: String,
|
2022-11-07 17:08:05 +08:00
|
|
|
default: 'default-linechart-id'
|
2022-11-07 08:45:49 +08:00
|
|
|
},
|
|
|
|
title: {
|
|
|
|
type: String,
|
|
|
|
default: 'default-title'
|
|
|
|
},
|
|
|
|
xData: {
|
|
|
|
type: Array,
|
|
|
|
default: () => []
|
|
|
|
},
|
|
|
|
seriesData: {
|
|
|
|
type: Array,
|
|
|
|
default: () => []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
chart: null,
|
|
|
|
option: {
|
|
|
|
color: ['#FF7345', '#52FFF1', '#6A6E87', '#9452FFA6'],
|
|
|
|
grid: {
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
right: '5%',
|
|
|
|
bottom: 0,
|
|
|
|
containLabel: true
|
|
|
|
},
|
|
|
|
xAxis: {
|
|
|
|
type: 'value',
|
|
|
|
boundaryGap: [0, 0.001],
|
|
|
|
axisTick: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
fontSize: 8
|
|
|
|
// rotate: 10
|
|
|
|
},
|
|
|
|
axisLine: {
|
|
|
|
show: false,
|
|
|
|
lineStyle: {
|
|
|
|
color: '#fffa'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
splitLine: {
|
|
|
|
lineStyle: {
|
|
|
|
color: '#fff3'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
yAxis: {
|
|
|
|
type: 'category',
|
|
|
|
data: ['产线1', '产线2', '产线3', '产线4', '产线5', '产线6'],
|
|
|
|
axisLine: {
|
|
|
|
show: false
|
|
|
|
},
|
|
|
|
axisLabel: {
|
|
|
|
fontSize: 10,
|
|
|
|
color: '#fffa'
|
|
|
|
},
|
|
|
|
axisTick: { show: false },
|
|
|
|
splitLine: {
|
|
|
|
lineStyle: {
|
|
|
|
color: '#fffa'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
series: [
|
|
|
|
{
|
|
|
|
name: '2011',
|
|
|
|
type: 'bar',
|
|
|
|
barWidth: 5,
|
|
|
|
data: Array(6)
|
|
|
|
.fill(0)
|
|
|
|
.map(value => Math.floor(Math.random() * 1000))
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '2012',
|
|
|
|
type: 'bar',
|
|
|
|
barWidth: 5,
|
|
|
|
data: Array(6)
|
|
|
|
.fill(0)
|
|
|
|
.map(value => Math.floor(Math.random() * 1000))
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
if (!this.chart) this.chart = echarts.init(this.$refs['techy-line-chart'])
|
|
|
|
this.chart.setOption(this.option)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
beforeDestroy() {
|
|
|
|
if (this.chart) this.chart.dispose()
|
|
|
|
this.chart = null
|
|
|
|
},
|
|
|
|
methods: {}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
.techy-chart {
|
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.techy-chart >>> div {
|
|
|
|
width: 100% !important;
|
|
|
|
}
|
|
|
|
</style>
|