Browse Source

优化图表

wangqin
zhangzhang 1 year ago
parent
commit
9b1a4f6bfc
  1. 2
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dayTotal/assets/charts.js
  2. 64
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dayTotal/index.vue
  3. 2
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventQuery/assets/charts3.js
  4. 58
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/monthStatistics/index.vue
  5. 2
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/railwayDay/assets/charts.js
  6. 85
      ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/railwayDay/index.vue

2
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dayTotal/assets/charts.js

@ -39,7 +39,7 @@ var options = {
}, },
}, },
grid: { grid: {
left: "1%", left: "10px",
right: "0%", right: "0%",
top: "16%", top: "16%",
bottom: "5%", bottom: "5%",

64
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/dayTotal/index.vue

@ -1,52 +1,55 @@
<template> <template>
<div class='congestion'> <div class="congestion">
<WgtTitle :title="'日累计感知事件趋势'"></WgtTitle> <WgtTitle :title="'日累计感知事件趋势'"></WgtTitle>
<div class="board"> <div class="board">
<Empty v-show="!dataList || dataList.length <= 0" text="暂无数据..."></Empty> <Empty
<div v-show="dataList && dataList.length > 0" style="width: 450px;" class="charts keep-ratio " id="daytotal"></div> v-show="!dataList || dataList.length <= 0"
text="暂无数据..."
></Empty>
<div
v-show="dataList && dataList.length > 0"
style="width: 450px"
class="charts keep-ratio"
id="daytotal"
></div>
</div> </div>
</div> </div>
</template> </template>
<script>
import WgtTitle from '../../../widgets/title' <script>
import WgtTitle from "../../../widgets/title";
import * as echarts from "echarts"; import * as echarts from "echarts";
import chartsStatistics from "./assets/charts"; import chartsStatistics from "./assets/charts";
import { getDailyCumulative } from '../../../../../../../api/event/perceiveEvent'; import { getDailyCumulative } from "../../../../../../../api/event/perceiveEvent";
import moment from "moment"; import moment from "moment";
export default { export default {
name: 'RailWayDay', name: "RailWayDay",
components: { components: {
WgtTitle WgtTitle,
}, },
data() { data() {
return { return {
dataList: [] dataList: [],
} };
},
created() {
}, },
methods: {
}, created() {},
methods: {},
mounted() { mounted() {
setTimeout(() => { setTimeout(() => {
this.$nextTick(() => { this.$nextTick(() => {
var myChart = echarts.init(document.getElementById('daytotal')); var myChart = echarts.init(document.getElementById("daytotal"));
getDailyCumulative().then(res => { getDailyCumulative().then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.dataList = res.data this.dataList = res.data;
let data = res.data; let data = res.data;
let timer = []; let timer = [];
let number = []; let number = [];
data.forEach((it) => { data.forEach((it) => {
timer.push(moment(it.time).format('HH:mm')); timer.push(moment(it.time).format("HH:mm"));
number.push(it.number); number.push(it.number);
}); });
@ -55,32 +58,34 @@ export default {
myChart.setOption(chartsStatistics); myChart.setOption(chartsStatistics);
} }
}); });
}); });
}); });
}, },
} };
</script> </script>
<style lang='scss' scoped> <style lang="scss" scoped>
.congestion { .congestion {
width: 100%; width: 100%;
.board { .board {
height: 200px; height: 200px;
width: 100%; width: 100%;
padding: 0px 20px; // padding: 0px 20px;
background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #064258 100%); background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #064258 100%);
border-radius: 5px 5px 5px 5px; border-radius: 5px 5px 5px 5px;
opacity: 1; opacity: 1;
border: 1px solid; border: 1px solid;
border-image: linear-gradient(360deg, rgba(55, 231, 255, 0.3), rgba(55, 231, 255, 0)) 1 1; border-image: linear-gradient(
360deg,
rgba(55, 231, 255, 0.3),
rgba(55, 231, 255, 0)
)
1 1;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
} }
@ -89,4 +94,3 @@ export default {
width: 100%; width: 100%;
} }
</style> </style>

2
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/eventQuery/assets/charts3.js

@ -54,7 +54,7 @@ let options = {
name: "(起)", name: "(起)",
nameTextStyle: { nameTextStyle: {
color: "#fff", color: "#fff",
fomtSize: 10, fontSize: 10,
align: "right", align: "right",
}, },
min: 0, min: 0,

58
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/monthStatistics/index.vue

@ -1,42 +1,44 @@
<template> <template>
<div class='congestion'> <div class="congestion">
<WgtTitle :title="'近一月感知事件时段分布统计'"></WgtTitle> <WgtTitle :title="'近一月感知事件时段分布统计'"></WgtTitle>
<div class="board"> <div class="board">
<Empty v-show="!dataList || dataList.length <= 0" text="暂无数据..."></Empty> <Empty
<div v-show="dataList && dataList.length > 0" style="width: 450px;" class="charts keep-ratio " id="monthStatistics"> v-show="!dataList || dataList.length <= 0"
</div> text="暂无数据..."
></Empty>
<div
v-show="dataList && dataList.length > 0"
style="width: 450px"
class="charts keep-ratio"
id="monthStatistics"
></div>
</div> </div>
</div> </div>
</template> </template>
<script>
import WgtTitle from '../../../widgets/title' <script>
import WgtTitle from "../../../widgets/title";
import * as echarts from "echarts"; import * as echarts from "echarts";
import chartsStatistics from "./assets/charts"; import chartsStatistics from "./assets/charts";
import { getDailyCumulativeMonth } from '../../../../../../../api/event/perceiveEvent'; import { getDailyCumulativeMonth } from "../../../../../../../api/event/perceiveEvent";
export default { export default {
name: 'MonthStatistics', name: "MonthStatistics",
components: { components: {
WgtTitle WgtTitle,
}, },
data() { data() {
return { return {
dataList: [] dataList: [],
} };
},
created() {
}, },
methods: {
}, created() {},
methods: {},
mounted() { mounted() {
setTimeout(() => { setTimeout(() => {
this.$nextTick(() => { this.$nextTick(() => {
var myChart = echarts.init(document.getElementById('monthStatistics')); var myChart = echarts.init(document.getElementById("monthStatistics"));
getDailyCumulativeMonth().then((res) => { getDailyCumulativeMonth().then((res) => {
console.log(res); console.log(res);
if (res.code == 200) { if (res.code == 200) {
@ -64,31 +66,34 @@ export default {
myChart.setOption(chartsStatistics); myChart.setOption(chartsStatistics);
} }
}); });
}); });
}); });
}, },
} };
</script> </script>
<style lang='scss' scoped> <style lang="scss" scoped>
.congestion { .congestion {
width: 100%; width: 100%;
.board { .board {
height: 200px; height: 200px;
width: 100%; width: 100%;
padding: 0px 20px; // padding: 0px 20px;
background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #064258 100%); background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #064258 100%);
border-radius: 5px 5px 5px 5px; border-radius: 5px 5px 5px 5px;
opacity: 1; opacity: 1;
border: 1px solid; border: 1px solid;
border-image: linear-gradient(360deg, rgba(55, 231, 255, 0.3), rgba(55, 231, 255, 0)) 1 1; border-image: linear-gradient(
360deg,
rgba(55, 231, 255, 0.3),
rgba(55, 231, 255, 0)
)
1 1;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
} }
@ -97,4 +102,3 @@ export default {
width: 100%; width: 100%;
} }
</style> </style>

2
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/railwayDay/assets/charts.js

@ -58,7 +58,7 @@ var options = {
grid: { grid: {
top: "15%", //上边距 top: "15%", //上边距
right: "0", //右边距 right: "0", //右边距
left: "0", //左边距 left: "10px", //左边距
bottom: "0%", //下边距 bottom: "0%", //下边距
containLabel: true, containLabel: true,
}, },

85
ruoyi-ui/src/views/JiHeExpressway/pages/perception/eventDetection/components/railwayDay/index.vue

@ -1,42 +1,44 @@
<template> <template>
<div class='congestion'> <div class="congestion">
<WgtTitle :title="'路段日感知事件'"></WgtTitle> <WgtTitle :title="'路段日感知事件'"></WgtTitle>
<div class="board"> <div class="board">
<Empty v-show="!dataList || dataList.length <= 0" text="暂无数据..."></Empty> <Empty
<div v-show="dataList && dataList.length > 0" style="width: 450px;" class="charts keep-ratio " id="railwayDay"> v-show="!dataList || dataList.length <= 0"
</div> text="暂无数据..."
></Empty>
<div
v-show="dataList && dataList.length > 0"
style="width: 450px"
class="charts keep-ratio"
id="railwayDay"
></div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import WgtTitle from "../../../widgets/title";
import WgtTitle from '../../../widgets/title'
import * as echarts from "echarts"; import * as echarts from "echarts";
import chartsStatistics from "./assets/charts"; import chartsStatistics from "./assets/charts";
import { getSectionPerceivedNumber } from '../../../../../../../api/event/perceiveEvent'; import { getSectionPerceivedNumber } from "../../../../../../../api/event/perceiveEvent";
export default { export default {
name: 'RailWayDay', name: "RailWayDay",
components: { components: {
WgtTitle WgtTitle,
}, },
data() { data() {
return { return {
dataList: [] dataList: [],
} };
}, },
created() { created() {},
methods: {},
},
methods: {
},
mounted() { mounted() {
setTimeout(() => { setTimeout(() => {
this.$nextTick(() => { this.$nextTick(() => {
var myChart = echarts.init(document.getElementById('railwayDay')); var myChart = echarts.init(document.getElementById("railwayDay"));
getSectionPerceivedNumber().then((res) => { getSectionPerceivedNumber().then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.dataList = res.data; this.dataList = res.data;
@ -44,9 +46,11 @@ export default {
if (data.length > 0) { if (data.length > 0) {
let texts = []; let texts = [];
let datas = []; let datas = [];
const maxObject = data.reduce((prev, current) => (current.number > prev.number ? current : prev)); const maxObject = data.reduce((prev, current) =>
current.number > prev.number ? current : prev
);
data.forEach(it => { data.forEach((it) => {
texts.push(it.sectionName); texts.push(it.sectionName);
if (it.number == maxObject.number) { if (it.number == maxObject.number) {
@ -54,62 +58,69 @@ export default {
value: it.number, value: it.number,
itemStyle: { itemStyle: {
color: { color: {
type: 'linear', type: "linear",
x: 0, x: 0,
y: 0, y: 0,
x2: 0, x2: 0,
y2: 1, y2: 1,
colorStops: [{ colorStops: [
offset: 0, color: '#0469FF' // 0% {
}, { offset: 0,
offset: 1, color: '#699CFF' // 100% color: "#0469FF", // 0%
}], },
global: false // false {
offset: 1,
color: "#699CFF", // 100%
},
],
global: false, // false
}, },
borderRadius: 6 borderRadius: 6,
}, },
}); });
} else { } else {
datas.push({ datas.push({
value: it.number, value: it.number,
itemStyle: { itemStyle: {
borderRadius: 6 borderRadius: 6,
}, },
}); });
} }
}); });
chartsStatistics.xAxis.data = texts; chartsStatistics.xAxis.data = texts;
chartsStatistics.series[0].data = datas; chartsStatistics.series[0].data = datas;
} }
myChart.setOption(chartsStatistics); myChart.setOption(chartsStatistics);
} }
}) });
}); });
}); });
}, },
} };
</script> </script>
<style lang='scss' scoped> <style lang="scss" scoped>
.congestion { .congestion {
width: 100%; width: 100%;
.board { .board {
height: 200px; height: 200px;
width: 100%; width: 100%;
padding: 0px 20px; // padding: 0px 20px;
background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #064258 100%); background: linear-gradient(180deg, rgba(6, 66, 88, 0.2) 0%, #064258 100%);
border-radius: 5px 5px 5px 5px; border-radius: 5px 5px 5px 5px;
opacity: 1; opacity: 1;
border: 1px solid; border: 1px solid;
border-image: linear-gradient(360deg, rgba(55, 231, 255, 0.3), rgba(55, 231, 255, 0)) 1 1; border-image: linear-gradient(
360deg,
rgba(55, 231, 255, 0.3),
rgba(55, 231, 255, 0)
)
1 1;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
} }

Loading…
Cancel
Save