|
@@ -1,269 +1,181 @@
|
|
|
<template>
|
|
|
- <div class="echartLine">
|
|
|
- <div class="line" ref="line"></div>
|
|
|
- </div>
|
|
|
+ <div class="echartLine">
|
|
|
+ <div class="line" ref="line"></div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
-
|
|
|
+
|
|
|
<script lang="ts" setup>
|
|
|
-import { onMounted, ref, defineEmits, nextTick, reactive, onUnmounted, watch, markRaw, defineAsyncComponent } from 'vue';
|
|
|
-import * as echarts from 'echarts'
|
|
|
+ import {defineProps, onMounted, ref, defineEmits, nextTick, reactive, onUnmounted, watch, markRaw, defineAsyncComponent } from 'vue';
|
|
|
+ import * as echarts from 'echarts';
|
|
|
|
|
|
-let props = defineProps({
|
|
|
+ let props = defineProps({
|
|
|
echartDataGq: {
|
|
|
- type: Object,
|
|
|
- default: () => {
|
|
|
- return {}
|
|
|
- }
|
|
|
- }
|
|
|
-})
|
|
|
-//获取dom元素节点
|
|
|
-let line = ref<any>()
|
|
|
-watch(() => props.echartDataGq, (data: never[]) => {
|
|
|
- console.log(data, '光钎图表数据')
|
|
|
- // props.echartDataGq = data
|
|
|
- getOption()
|
|
|
-}, { immediate: true })
|
|
|
-function getOption() {
|
|
|
+ type: Object,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ //获取dom元素节点
|
|
|
+ let line = ref<any>();
|
|
|
+ let echartDataGqs=reactive({})
|
|
|
+ watch(
|
|
|
+ () => props.echartDataGq,
|
|
|
+ (data) => {
|
|
|
+ console.log(data, '光钎图表数据');
|
|
|
+ echartDataGqs=Object.assign({},data)
|
|
|
+ getOption();
|
|
|
+ },
|
|
|
+ { immediate: true,deep:true }
|
|
|
+ );
|
|
|
+ function getOption() {
|
|
|
nextTick(() => {
|
|
|
- const myChart = echarts.init(line.value)
|
|
|
- let option = {
|
|
|
- grid: {
|
|
|
- top: '6%',
|
|
|
- left: '4%',
|
|
|
- bottom: '18%',
|
|
|
- right: '5%',
|
|
|
- // containLabel: true,
|
|
|
+ const myChart = echarts.init(line.value);
|
|
|
+ let option = {
|
|
|
+ grid: {
|
|
|
+ top: '6%',
|
|
|
+ left: '4%',
|
|
|
+ bottom: '8%',
|
|
|
+ right: '5%',
|
|
|
+ containLabel: true,
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'axis',
|
|
|
+
|
|
|
+ },
|
|
|
+ xAxis: [
|
|
|
+ {
|
|
|
+ type: 'category',
|
|
|
+ boundaryGap: false,
|
|
|
+ axisLabel: {
|
|
|
+ formatter: '{value}',
|
|
|
+ fontSize: 14,
|
|
|
+ margin: 20,
|
|
|
+ textStyle: {
|
|
|
+ color: '#b3b8cc',
|
|
|
+ },
|
|
|
},
|
|
|
- tooltip: {
|
|
|
- trigger: 'axis',
|
|
|
- // axisPointer: {
|
|
|
- // lineStyle: {
|
|
|
- // color: {
|
|
|
- // type: 'linear',
|
|
|
- // x: 0,
|
|
|
- // y: 0,
|
|
|
- // x2: 0,
|
|
|
- // y2: 1,
|
|
|
- // colorStops: [
|
|
|
- // {
|
|
|
- // offset: 0,
|
|
|
- // color: 'rgba(255,255,255,0)', // 0% 处的颜色
|
|
|
- // },
|
|
|
- // {
|
|
|
- // offset: 0.5,
|
|
|
- // color: 'rgba(255,255,255,1)', // 100% 处的颜色
|
|
|
- // },
|
|
|
- // {
|
|
|
- // offset: 1,
|
|
|
- // color: 'rgba(255,255,255,0)', // 100% 处的颜色
|
|
|
- // },
|
|
|
- // ],
|
|
|
- // global: false, // 缺省为 false
|
|
|
- // },
|
|
|
- // },
|
|
|
- // },
|
|
|
+ axisLine: {
|
|
|
+ lineStyle: {
|
|
|
+ color: 'rgba(14, 53, 95)',
|
|
|
+ },
|
|
|
},
|
|
|
- xAxis: [
|
|
|
- {
|
|
|
- type: 'category',
|
|
|
- boundaryGap: false,
|
|
|
- axisLabel: {
|
|
|
- formatter: '{value}',
|
|
|
- fontSize: 14,
|
|
|
- margin: 20,
|
|
|
- textStyle: {
|
|
|
- color: '#b3b8cc',
|
|
|
- },
|
|
|
- },
|
|
|
- axisLine: {
|
|
|
- lineStyle: {
|
|
|
- color: 'rgba(14, 53, 95)',
|
|
|
- },
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- show: false,
|
|
|
- // lineStyle: {
|
|
|
- // color: '#243753',
|
|
|
- // },
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- data: props.echartDataGq.xData,
|
|
|
- },
|
|
|
- ],
|
|
|
- yAxis: [
|
|
|
- {
|
|
|
- boundaryGap: false,
|
|
|
- type: 'value',
|
|
|
- max: 50,
|
|
|
- axisLabel: {
|
|
|
- textStyle: {
|
|
|
- color: '#b3b8cc',
|
|
|
- },
|
|
|
- },
|
|
|
- nameTextStyle: {
|
|
|
- color: '#fff',
|
|
|
- fontSize: 12,
|
|
|
- lineHeight: 40,
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- lineStyle: {
|
|
|
- color: 'rgba(14, 53, 95)',
|
|
|
- },
|
|
|
- },
|
|
|
- axisLine: {
|
|
|
- show: true,
|
|
|
- lineStyle: {
|
|
|
- color: 'rgba(14, 53, 95)',
|
|
|
- },
|
|
|
- },
|
|
|
- axisTick: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- },
|
|
|
- ],
|
|
|
- series: [
|
|
|
- {
|
|
|
- name: '最大值',
|
|
|
- type: 'line',
|
|
|
- smooth: true,
|
|
|
- showSymbol: true,
|
|
|
- symbolSize: 8,
|
|
|
- zlevel: 3,
|
|
|
- itemStyle: {
|
|
|
- color: '#19a3df',
|
|
|
- borderColor: '#a3c8d8',
|
|
|
- },
|
|
|
- lineStyle: {
|
|
|
- normal: {
|
|
|
- width: 2,
|
|
|
- color: '#19a3df',
|
|
|
- },
|
|
|
- },
|
|
|
- // areaStyle: {
|
|
|
- // normal: {
|
|
|
- // color: new echarts.graphic.LinearGradient(
|
|
|
- // 0,
|
|
|
- // 0,
|
|
|
- // 0,
|
|
|
- // 1,
|
|
|
- // [
|
|
|
- // {
|
|
|
- // offset: 0,
|
|
|
- // color: 'rgba(88,255,255,0.2)',
|
|
|
- // },
|
|
|
- // {
|
|
|
- // offset: 0.8,
|
|
|
- // color: 'rgba(88,255,255,0)',
|
|
|
- // },
|
|
|
- // ],
|
|
|
- // false
|
|
|
- // ),
|
|
|
- // },
|
|
|
- // },
|
|
|
- data: props.echartDataGq.maxData,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '最小值',
|
|
|
- type: 'line',
|
|
|
- smooth: true,
|
|
|
- showSymbol: true,
|
|
|
- symbolSize: 8,
|
|
|
- zlevel: 3,
|
|
|
- itemStyle: {
|
|
|
- color: '#4fffad',
|
|
|
- borderColor: '#a3c8d8',
|
|
|
- },
|
|
|
- lineStyle: {
|
|
|
- normal: {
|
|
|
- width: 2,
|
|
|
- color: '#4fffad',
|
|
|
- },
|
|
|
- },
|
|
|
- // areaStyle: {
|
|
|
- // normal: {
|
|
|
- // color: new echarts.graphic.LinearGradient(
|
|
|
- // 0,
|
|
|
- // 0,
|
|
|
- // 0,
|
|
|
- // 1,
|
|
|
- // [
|
|
|
- // {
|
|
|
- // offset: 0,
|
|
|
- // color: 'rgba(88,255,255,0.2)',
|
|
|
- // },
|
|
|
- // {
|
|
|
- // offset: 0.8,
|
|
|
- // color: 'rgba(88,255,255,0)',
|
|
|
- // },
|
|
|
- // ],
|
|
|
- // false
|
|
|
- // ),
|
|
|
- // },
|
|
|
- // },
|
|
|
- data: props.echartDataGq.minData,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '平均值',
|
|
|
- type: 'line',
|
|
|
- smooth: true,
|
|
|
- showSymbol: true,
|
|
|
- symbolSize: 8,
|
|
|
- zlevel: 3,
|
|
|
- itemStyle: {
|
|
|
- color: '#fc8452',
|
|
|
- borderColor: '#a3c8d8',
|
|
|
- },
|
|
|
- lineStyle: {
|
|
|
- normal: {
|
|
|
- width: 2,
|
|
|
- color: '#fc8452',
|
|
|
- },
|
|
|
- },
|
|
|
- // areaStyle: {
|
|
|
- // normal: {
|
|
|
- // color: new echarts.graphic.LinearGradient(
|
|
|
- // 0,
|
|
|
- // 0,
|
|
|
- // 0,
|
|
|
- // 1,
|
|
|
- // [
|
|
|
- // {
|
|
|
- // offset: 0,
|
|
|
- // color: 'rgba(88,255,255,0.2)',
|
|
|
- // },
|
|
|
- // {
|
|
|
- // offset: 0.8,
|
|
|
- // color: 'rgba(88,255,255,0)',
|
|
|
- // },
|
|
|
- // ],
|
|
|
- // false
|
|
|
- // ),
|
|
|
- // },
|
|
|
- // },
|
|
|
- data: props.echartDataGq.aveValue,
|
|
|
- },
|
|
|
- ],
|
|
|
- }
|
|
|
- myChart.setOption(option)
|
|
|
- window.onresize = function () {
|
|
|
- myChart.resize()
|
|
|
- }
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
+ splitLine: {
|
|
|
+ show: false,
|
|
|
+ // lineStyle: {
|
|
|
+ // color: '#243753',
|
|
|
+ // },
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ data: echartDataGqs.xData,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ yAxis: [
|
|
|
+ {
|
|
|
+ boundaryGap: false,
|
|
|
+ type: 'value',
|
|
|
+ max: 5000,
|
|
|
+ axisLabel: {
|
|
|
+ textStyle: {
|
|
|
+ color: '#b3b8cc',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ nameTextStyle: {
|
|
|
+ color: '#fff',
|
|
|
+ fontSize: 12,
|
|
|
+ lineHeight: 40,
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ lineStyle: {
|
|
|
+ color: 'rgba(14, 53, 95)',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisLine: {
|
|
|
+ show: true,
|
|
|
+ lineStyle: {
|
|
|
+ color: 'rgba(14, 53, 95)',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ axisTick: {
|
|
|
+ show: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: '最大值',
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ showSymbol: true,
|
|
|
+ symbolSize: 8,
|
|
|
+ zlevel: 3,
|
|
|
+ itemStyle: {
|
|
|
+ color: '#19a3df',
|
|
|
+ borderColor: '#a3c8d8',
|
|
|
+ },
|
|
|
+ lineStyle: {
|
|
|
+ normal: {
|
|
|
+ width: 2,
|
|
|
+ color: '#19a3df',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data:echartDataGqs.maxData,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '最小值',
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ showSymbol: true,
|
|
|
+ symbolSize: 8,
|
|
|
+ zlevel: 3,
|
|
|
+ itemStyle: {
|
|
|
+ color: '#4fffad',
|
|
|
+ borderColor: '#a3c8d8',
|
|
|
+ },
|
|
|
+ lineStyle: {
|
|
|
+ normal: {
|
|
|
+ width: 2,
|
|
|
+ color: '#4fffad',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data:echartDataGqs.minData,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '平均值',
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ showSymbol: true,
|
|
|
+ symbolSize: 8,
|
|
|
+ zlevel: 3,
|
|
|
+ itemStyle: {
|
|
|
+ color: '#fc8452',
|
|
|
+ borderColor: '#a3c8d8',
|
|
|
+ },
|
|
|
+ lineStyle: {
|
|
|
+ normal: {
|
|
|
+ width: 2,
|
|
|
+ color: '#fc8452',
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ data: echartDataGqs.aveValue,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ myChart.setOption(option);
|
|
|
+ window.onresize = function () {
|
|
|
+ myChart.resize();
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
</script>
|
|
|
-
|
|
|
-<style scoped lang='less'>
|
|
|
-.echartLine {
|
|
|
+
|
|
|
+<style scoped lang="less">
|
|
|
+ .echartLine {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
-
|
|
|
.line {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
}
|
|
|
-}
|
|
|
-</style>
|
|
|
+ }
|
|
|
+</style>
|