123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <template>
- <el-dialog
- width="70%"
- @open="opened()"
- @closed="closed()"
- :show-close="true"
- class="dialogs"
- >
- <template #title>
- <div class="showTitles">
- <div class="stationName">
- <div class="titleName">{{ showData?.name?.name }}</div>
- <div class="titleNames" v-if="showData?.name?.names">
- ({{ showData?.name?.names }})
- </div>
- </div>
- </div>
- </template>
- <div class="bodyy">
- <div id="showEcharts" class="echarts"></div>
- </div>
- </el-dialog>
- </template>
- <script>
- import * as echarts from "echarts";
- export default {
- props: {
- showData: {
- type: String,
- default: "",
- },
- },
- updated() {
- this.showEcharts(this.showData);
- },
- methods: {
- showEcharts(showData) {
- let chartDom = document.getElementById("showEcharts");
- chartDom.removeAttribute("_echarts_instance_")
- let myChart = echarts.init(chartDom, "#ffffff");
- let option;
- option = {
- tooltip: {
- trigger: "axis",
- },
- legend: {
- show: true,
- data: showData.value.map((t) => {
- return t.title;
- }),
- right: 56,
- icon: "circle",
- itemWidth: 6,
- inactiveColor: "#606769",
- textStyle: {
- color: "#B3BDC0",
- fontSize: 12,
- },
- },
- xAxis: [
- {
- type: "category",
- boundaryGap: false,
- axisLabel: {
- interval: 60,
- showMinLabel: true,
- showMaxLabel: true,
- formatter: "{value}",
- fontSize: 14,
- textStyle: {
- color: "#606769",
- },
- },
- axisLine: {
- show: false,
- },
- data: showData.value[0].value.map((item) => {
- return item.text;
- }),
- },
- ],
- yAxis: {
- type: "value",
- axisLabel: {
- formatter: "{value}",
- fontSize: 14,
- },
- axisLine: {
- show: false,
- },
- splitLine: {
- show: true,
- lineStyle: {
- color: "#606769",
- type: "dashed",
- },
- },
- },
- series: [
- {
- name: showData.value[0].title,
- smooth: true,
- showSymbol: false,
- data: showData.value[0].value.map((item) => {
- return item.value;
- }),
- type: "line",
- lineStyle: {
- normal: {
- color: "rgba(75, 85, 174, 1)",
- width: 1,
- },
- },
- },
- {
- name: showData.value[1].title,
- smooth: true,
- showSymbol: false,
- data: showData.value[1].value.map((item) => {
- return item.value;
- }),
- type: "line",
- lineStyle: {
- normal: {
- color: "rgba(05, 187, 76, 1)",
- width: 1,
- },
- },
- },
- ],
- };
- option && myChart.setOption(option);
- },
- opened() {
- },
- closed() {
- this.$emit("closeds");
- },
- },
- };
- </script>
- <style scoped>
- .echarts {
- width: 1300px;
- height: 60vh;
- }
- .stationName {
- font-size: 20px;
- width: 400px;
- height: 45px;
- display: flex;
- flex-direction: row;
- align-items: baseline;
- justify-content: center;
- color: #ffffff;
- }
- .titleName {
- margin-top: 10px;
- }
- .titleNames {
- font-size: 12px;
- margin-left: 10px;
- margin-top: 10px;
- }
- </style>
|