diff --git a/src/components/公共组件/GraphBase/index.module.css b/src/components/公共组件/GraphBase/index.module.css
index 8dbe2f8..618a661 100644
--- a/src/components/公共组件/GraphBase/index.module.css
+++ b/src/components/公共组件/GraphBase/index.module.css
@@ -73,7 +73,7 @@
.graphBaseContent {
height: 1px;
flex: 1;
- background: #fff3;
+ /* background: #fff3; */
}
.graphBaseDesc {
diff --git a/src/components/模块组件/能耗分析/一氧化氮/index.jsx b/src/components/模块组件/能耗分析/一氧化氮/index.jsx
index 3c6c278..96fd2b4 100644
--- a/src/components/模块组件/能耗分析/一氧化氮/index.jsx
+++ b/src/components/模块组件/能耗分析/一氧化氮/index.jsx
@@ -1,4 +1,6 @@
import GraphBase from '../../../公共组件/GraphBase';
+import ReactECharts from 'echarts-for-react';
+import getOptions from '../../../../hooks/getChartOption';
function NO(props) {
function handleSwitch(v) {
@@ -22,6 +24,18 @@ function NO(props) {
size={['long', 'middle']}
>
{/* real echarts here */}
+
{/* real table data here */}
);
diff --git a/src/components/模块组件/能耗分析/二氧化氮 copy/index.jsx b/src/components/模块组件/能耗分析/二氧化氮 copy/index.jsx
deleted file mode 100644
index db0c966..0000000
--- a/src/components/模块组件/能耗分析/二氧化氮 copy/index.jsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import GraphBase from '../../../公共组件/GraphBase';
-
-function NO2(props) {
- function handleSwitch(v) {
- console.log('switched ', v);
- }
-
- function handleDateChange(v) {
- console.log('date ', v);
- }
-
- return (
-
- {/* real echarts here */}
- {/* real table data here */}
-
- );
-}
-
-export default NO2;
diff --git a/src/components/模块组件/能耗分析/二氧化氮/index.jsx b/src/components/模块组件/能耗分析/二氧化氮/index.jsx
index db0c966..04fb4a2 100644
--- a/src/components/模块组件/能耗分析/二氧化氮/index.jsx
+++ b/src/components/模块组件/能耗分析/二氧化氮/index.jsx
@@ -1,4 +1,6 @@
import GraphBase from '../../../公共组件/GraphBase';
+import ReactECharts from 'echarts-for-react';
+import getOptions from '../../../../hooks/getChartOption';
function NO2(props) {
function handleSwitch(v) {
@@ -22,6 +24,18 @@ function NO2(props) {
size={['long', 'middle']}
>
{/* real echarts here */}
+
{/* real table data here */}
);
diff --git a/src/components/模块组件/能耗分析/二氧化硫/index.jsx b/src/components/模块组件/能耗分析/二氧化硫/index.jsx
index e4c8ddc..4bbb060 100644
--- a/src/components/模块组件/能耗分析/二氧化硫/index.jsx
+++ b/src/components/模块组件/能耗分析/二氧化硫/index.jsx
@@ -1,4 +1,6 @@
import GraphBase from '../../../公共组件/GraphBase';
+import ReactECharts from 'echarts-for-react';
+import getOptions from '../../../../hooks/getChartOption';
function SO2(props) {
function handleSwitch(v) {
@@ -22,6 +24,18 @@ function SO2(props) {
size={['long', 'middle']}
>
{/* real echarts here */}
+
{/* real table data here */}
);
diff --git a/src/components/模块组件/能耗分析/余热发电/index.jsx b/src/components/模块组件/能耗分析/余热发电/index.jsx
index eef0814..1c0d892 100644
--- a/src/components/模块组件/能耗分析/余热发电/index.jsx
+++ b/src/components/模块组件/能耗分析/余热发电/index.jsx
@@ -1,4 +1,6 @@
import GraphBase from '../../../公共组件/GraphBase';
+import ReactECharts from 'echarts-for-react';
+import getOptions from '../../../../hooks/getChartOption';
function RestHeat(props) {
function handleSwitch(v) {
@@ -22,6 +24,18 @@ function RestHeat(props) {
size={['long', 'middle']}
>
{/* real echarts here */}
+
{/* real table data here */}
);
diff --git a/src/components/模块组件/能耗分析/天然气/index.jsx b/src/components/模块组件/能耗分析/天然气/index.jsx
index 5bb7bb8..47072aa 100644
--- a/src/components/模块组件/能耗分析/天然气/index.jsx
+++ b/src/components/模块组件/能耗分析/天然气/index.jsx
@@ -1,4 +1,6 @@
import GraphBase from '../../../公共组件/GraphBase';
+import ReactECharts from 'echarts-for-react';
+import getOptions from '../../../../hooks/getChartOption';
function NatGas(props) {
function handleSwitch(v) {
@@ -22,6 +24,11 @@ function NatGas(props) {
size={['long', 'short']}
>
{/* real echarts here */}
+
{/* real table data here */}
);
diff --git a/src/components/模块组件/能耗分析/氧气含量/index.jsx b/src/components/模块组件/能耗分析/氧气含量/index.jsx
index de85f13..5a6349f 100644
--- a/src/components/模块组件/能耗分析/氧气含量/index.jsx
+++ b/src/components/模块组件/能耗分析/氧气含量/index.jsx
@@ -1,4 +1,27 @@
import GraphBase from '../../../公共组件/GraphBase';
+import ReactECharts from 'echarts-for-react';
+import getOptions from '../../../../hooks/getChartOption';
+
+// function rand(max) {
+// return Math.ceil(Math.random() * max);
+// }
+// function getArr(len) {
+// return Array(len).fill(1).map(() => rand(100))
+// }
+// function getArrs(len) {
+// return Array(len).fill(1).map(() => getArr(7))
+// }
+// function fan4(...arrs) {
+// const total = arrs[0].map((_, i) =>
+// arrs.reduce((sum, arr) => sum + arr[i], 0),
+// );
+// arrs.unshift(total);
+// return arrs;
+// }
+// function main() {
+// // console.log(JSON.stringify(fan(getArrs(3))))
+// console.log(fan(getArrs(3)))
+// }
function Oxygen(props) {
function handleSwitch(v) {
@@ -22,6 +45,18 @@ function Oxygen(props) {
size={['long', 'middle']}
>
{/* real echarts here */}
+
{/* real table data here */}
);
diff --git a/src/components/模块组件/能耗分析/水耗能/index.jsx b/src/components/模块组件/能耗分析/水耗能/index.jsx
index 1e6fb87..8ad0349 100644
--- a/src/components/模块组件/能耗分析/水耗能/index.jsx
+++ b/src/components/模块组件/能耗分析/水耗能/index.jsx
@@ -1,4 +1,6 @@
import GraphBase from '../../../公共组件/GraphBase';
+import ReactECharts from 'echarts-for-react';
+import getOptions from '../../../../hooks/getChartOption';
function WaterCost(props) {
function handleSwitch(v) {
@@ -22,6 +24,18 @@ function WaterCost(props) {
size={['long', 'middle']}
>
{/* real echarts here */}
+
{/* real table data here */}
);
diff --git a/src/components/模块组件/能耗分析/焦炉煤气/index.jsx b/src/components/模块组件/能耗分析/焦炉煤气/index.jsx
index fac5344..de74d3e 100644
--- a/src/components/模块组件/能耗分析/焦炉煤气/index.jsx
+++ b/src/components/模块组件/能耗分析/焦炉煤气/index.jsx
@@ -1,4 +1,6 @@
import GraphBase from '../../../公共组件/GraphBase';
+import ReactECharts from 'echarts-for-react';
+import getOptions from '../../../../hooks/getChartOption';
function Gas(props) {
function handleSwitch(v) {
@@ -22,6 +24,11 @@ function Gas(props) {
size={['long', 'short']}
>
{/* real echarts here */}
+
{/* real table data here */}
);
diff --git a/src/components/模块组件/能耗分析/电耗能/index.jsx b/src/components/模块组件/能耗分析/电耗能/index.jsx
index c4386bb..09fa695 100644
--- a/src/components/模块组件/能耗分析/电耗能/index.jsx
+++ b/src/components/模块组件/能耗分析/电耗能/index.jsx
@@ -1,4 +1,6 @@
import GraphBase from '../../../公共组件/GraphBase';
+import ReactECharts from 'echarts-for-react';
+import getOptions from '../../../../hooks/getChartOption';
function ElecCost(props) {
function handleSwitch(v) {
@@ -22,6 +24,11 @@ function ElecCost(props) {
size={['long', 'short']}
>
{/* real echarts here */}
+
{/* real table data here */}
);
diff --git a/src/hooks/getChartOption.js b/src/hooks/getChartOption.js
new file mode 100644
index 0000000..b5f4c63
--- /dev/null
+++ b/src/hooks/getChartOption.js
@@ -0,0 +1,97 @@
+import * as echarts from 'echarts';
+
+export default function getOptions(seriesData, name) {
+ const colors = [
+ '#FFD160',
+ '#12FFF5',
+ '#2760FF',
+ '#E80091',
+ '#8064ff',
+ '#ff8a3b',
+ '#8cd26d',
+ '#2aa1ff',
+ ];
+ return {
+ color: colors,
+ grid: { top: 38, right: 12, bottom: 20, left: 48 },
+ legend: {
+ show: false,
+ icon: 'roundRect',
+ top: 10,
+ right: 10,
+ padding: 0,
+ itemWidth: 8,
+ itemHeight: 8,
+ itemGap: 3,
+ height: 8,
+ textStyle: {
+ color: '#DFF1FE',
+ fontSize: 10,
+ },
+ },
+ xAxis: {
+ type: 'category',
+ data: Array(7)
+ .fill(1)
+ .map((_, index) => {
+ const today = new Date();
+ const dtimestamp = today - index * 24 * 60 * 60 * 1000;
+ return `${new Date(dtimestamp).getMonth() + 1}.${new Date(
+ dtimestamp,
+ ).getDate()}`;
+ })
+ .reverse(),
+ axisLabel: {
+ color: '#fff',
+ fontSize: 12,
+ },
+ axisTick: { show: false },
+ axisLine: {
+ lineStyle: {
+ width: 1,
+ color: '#213259',
+ },
+ },
+ },
+ yAxis: {
+ name: '单位m³/h',
+ nameTextStyle: {
+ color: '#fff',
+ fontSize: 10,
+ align: 'right',
+ },
+ type: 'value',
+ axisLabel: {
+ color: '#fff',
+ fontSize: 12,
+ formatter: '{value}',
+ },
+ axisLine: {
+ show: true,
+ lineStyle: {
+ color: '#213259',
+ },
+ },
+ splitLine: {
+ lineStyle: {
+ color: '#213259a0',
+ },
+ },
+ },
+ series: seriesData.map((arr, index) => ({
+ name: index + 1 + '#' + name,
+ data: arr,
+ type: 'line',
+ areaStyle: {
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
+ { offset: 0, color: colors[index] + '40' },
+ { offset: 0.5, color: colors[index] + '20' },
+ { offset: 1, color: colors[index] + '00' },
+ ]),
+ },
+ })),
+ tooltip: {
+ trigger: 'axis',
+ },
+ };
+}
diff --git a/src/hooks/useChart.js b/src/hooks/useChart.js
new file mode 100644
index 0000000..860394f
--- /dev/null
+++ b/src/hooks/useChart.js
@@ -0,0 +1,3 @@
+function useChart(el, data) {
+ return
chart
;
+}
diff --git a/src/pages/能耗分析/index.jsx b/src/pages/能耗分析/index.jsx
index 9f7484f..e826ea2 100644
--- a/src/pages/能耗分析/index.jsx
+++ b/src/pages/能耗分析/index.jsx
@@ -30,7 +30,7 @@ function EnergyAnalysis(props) {
-
+