|
@@ -3,6 +3,7 @@
|
|
|
<Chart v-if="chartOptions1.series.length != 0" style="min-height: 600px;" :options="chartOptions1"
|
|
|
constructor-type="stockChart">
|
|
|
</Chart>
|
|
|
+
|
|
|
<div style="text-align: center;margin-top: 20px;">{{ computedData }}</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -11,7 +12,7 @@
|
|
|
import emitter from "@/plugin/bus";
|
|
|
// const emit = defineEmits(['submit']);
|
|
|
import { Chart } from 'highcharts-vue';
|
|
|
-import { computed, onBeforeUnmount, reactive, watch, ref ,nextTick} from "vue";
|
|
|
+import { computed, onBeforeUnmount, reactive, watch, ref, nextTick } from "vue";
|
|
|
import { useMessage } from "naive-ui";
|
|
|
import { useStore } from 'vuex'
|
|
|
const message = useMessage()
|
|
@@ -21,7 +22,7 @@ const popData = defineProps({
|
|
|
default: () => [],
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
+import { TimeData } from '@/plugin/timeFun';
|
|
|
const plotLinesData = reactive({
|
|
|
tBottom: null,
|
|
|
tTop: null
|
|
@@ -29,21 +30,21 @@ const plotLinesData = reactive({
|
|
|
const store = useStore()
|
|
|
const plot = computed(() => store.state.plotLineList)
|
|
|
|
|
|
-nextTick(()=>{
|
|
|
+nextTick(() => {
|
|
|
chartOptions1.yAxis.plotLines[0].value = plot.value.tTop
|
|
|
chartOptions1.yAxis.plotLines[0].label.text = `上限(${plot.value.tTop}Rh)`, //标签的内容
|
|
|
- chartOptions1.yAxis.plotLines[1].value = plot.value.tBottom
|
|
|
+ chartOptions1.yAxis.plotLines[1].value = plot.value.tBottom
|
|
|
chartOptions1.yAxis.plotLines[1].label.text = `下限(${plot.value.tBottom}Rh)` //标签的内容
|
|
|
})
|
|
|
emitter.on("onFormData", (val) => {
|
|
|
- console.log("打印11111:", val);
|
|
|
+ console.log("打印11111:", val);
|
|
|
});
|
|
|
//设置就展示
|
|
|
emitter.on("onMessage", (val) => {
|
|
|
- console.log('123',val)
|
|
|
+ console.log('123', val)
|
|
|
chartOptions1.yAxis.plotLines[0].value = val.tTop
|
|
|
chartOptions1.yAxis.plotLines[0].label.text = `上限(${val.tTop}Rh)`, //标签的内容
|
|
|
- chartOptions1.yAxis.plotLines[1].value = val.tBottom
|
|
|
+ chartOptions1.yAxis.plotLines[1].value = val.tBottom
|
|
|
chartOptions1.yAxis.plotLines[1].label.text = `下限(${val.tBottom}Rh)` //标签的内容
|
|
|
});
|
|
|
//关闭
|
|
@@ -81,13 +82,12 @@ const computedDataFun = () => {
|
|
|
|
|
|
return `最大值${maxData},最小值${minData},平均值${pingjun}`
|
|
|
}
|
|
|
-
|
|
|
watch(() => popData.dataList, (newValue) => {
|
|
|
chartOptions1.series = []
|
|
|
- nextTick(()=>{
|
|
|
+ nextTick(() => {
|
|
|
chartOptions1.series = newValue
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
}, { deep: true, immediate: false })
|
|
|
|
|
|
const emit = defineEmits(['setTimeFun']);
|
|
@@ -107,9 +107,21 @@ const chartOptions1 = reactive({
|
|
|
useGPUTranslations: true
|
|
|
},
|
|
|
|
|
|
+ // tooltip: {
|
|
|
+ // xDateFormat: '%Y-%m-%d %H:%M:%S',
|
|
|
+
|
|
|
+ // },
|
|
|
tooltip: {
|
|
|
- xDateFormat: '%Y-%m-%d %H:%M:%S',
|
|
|
+ formatter: function () {
|
|
|
+ var s = TimeData(this.points[0].x)+'<br/>';
|
|
|
+ for (let i in this.points) {
|
|
|
+ s += '<br/>'+`<div style='color:${this.points[i].series.color}'>`+this.points[i].series.name + ': ' + (this.points[i].y).toFixed(1)+'°C</div>';
|
|
|
+ }
|
|
|
+ return s;
|
|
|
+ },
|
|
|
+ shared: false
|
|
|
},
|
|
|
+
|
|
|
yAxis: {
|
|
|
opposite: false, //设置y轴提示在左边
|
|
|
title: {
|
|
@@ -147,11 +159,11 @@ const chartOptions1 = reactive({
|
|
|
// symbol: 'triangle' //曲线点类型:”circle”, “square”, “diamond”, “triangle”,”triangle-down”,默认是”circle”
|
|
|
// }
|
|
|
marker: {
|
|
|
- enabled : true,
|
|
|
- radius : 3,
|
|
|
+ enabled: true,
|
|
|
+ radius: 3,
|
|
|
// symbol: 'url(https://www.highcharts.com/samples/graphics/sun.png)'
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
},
|
|
|
|
|
@@ -163,10 +175,10 @@ const chartOptions1 = reactive({
|
|
|
enabled: false,
|
|
|
},
|
|
|
rangeSelector: {
|
|
|
- buttons: [], // 不显示左边的zoom
|
|
|
- selected: 1,
|
|
|
- inputEnabled: false // 不显示日期输入框
|
|
|
- },
|
|
|
+ buttons: [], // 不显示左边的zoom
|
|
|
+ selected: 1,
|
|
|
+ inputEnabled: false // 不显示日期输入框
|
|
|
+ },
|
|
|
boost: {
|
|
|
useGPUTranslations: true,
|
|
|
seriesThreshold: 5,
|
|
@@ -189,14 +201,15 @@ const chartOptions1 = reactive({
|
|
|
},
|
|
|
events: {
|
|
|
selection(event) {
|
|
|
+ console.log('框选', event)
|
|
|
if (event.xAxis) {
|
|
|
// if (store.state.focuDatas!=null) {
|
|
|
// chartOptions1.chart.zooming.type = ''
|
|
|
// }else{
|
|
|
// chartOptions1.chart.zooming.type = 'x'
|
|
|
// }
|
|
|
- console.log('框选',store.state.focuDatas)
|
|
|
- emitter.emit("onSelectionTime",event.xAxis);
|
|
|
+
|
|
|
+ emitter.emit("onSelectionTime", event.xAxis);
|
|
|
emit("setTimeFun", event.xAxis)
|
|
|
}
|
|
|
},
|
|
@@ -206,4 +219,9 @@ const chartOptions1 = reactive({
|
|
|
series: [],
|
|
|
})
|
|
|
|
|
|
-</script>
|
|
|
+</script>
|
|
|
+<style>
|
|
|
+ .sc{
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+</style>
|