zhp #4

Merged
juzi merged 2 commits from zhp into features/warning 2024-08-30 19:10:44 +08:00
4 changed files with 17 additions and 38 deletions
Showing only changes of commit e4e9ba11c3 - Show all commits

View File

@ -1,7 +1,7 @@
/* /*
* @Author: zhp * @Author: zhp
* @Date: 2024-08-23 14:44:30 * @Date: 2024-08-23 14:44:30
* @LastEditTime: 2024-08-30 17:14:19 * @LastEditTime: 2024-08-30 17:28:20
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
*/ */
@ -25,8 +25,9 @@ function KilnBottomForecast(props) {
kilnInfo.forecastWeeklyChart.forEach((ele) => { kilnInfo.forecastWeeklyChart.forEach((ele) => {
data.push(ele.sum); data.push(ele.sum);
xData.push(moment(ele.dataTime).format('MM-DD')); xData.push(moment(ele.dataTime).format('MM-DD'));
}); })
const [dataSource, setDataSource] = useState({ console.log('data',data);
const dataSource= {
color1: '#146CFF', color1: '#146CFF',
color:'rgba(255, 194, 20, 1)', color:'rgba(255, 194, 20, 1)',
yName:'℃', yName:'℃',
@ -36,15 +37,8 @@ function KilnBottomForecast(props) {
xData, xData,
data: data? data : [], data: data? data : [],
range:[-10,10], range:[-10,10],
modelFlag: false
});
useEffect(() => {
setDataSource(prevDataSource => ({
...prevDataSource,
modelFlag: value modelFlag: value
})); }
}, [value]);
return ( return (
<BottomBarItem <BottomBarItem

View File

@ -1,7 +1,7 @@
/* /*
* @Author: zhp * @Author: zhp
* @Date: 2024-08-23 14:44:30 * @Date: 2024-08-23 14:44:30
* @LastEditTime: 2024-08-30 17:03:44 * @LastEditTime: 2024-08-30 17:31:40
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
*/ */
@ -15,25 +15,17 @@ import { HomeContext } from '../../../../../pages/Home';
function KilnMiddleForecast(props) { function KilnMiddleForecast(props) {
const value = useContext(HomeContext); const value = useContext(HomeContext);
const kilnOptimize = useSelector((state) => state.kilnOptimize); const kilnOptimize = useSelector((state) => state.kilnOptimize);
const dataSource = {
const [dataSource, setDataSource] = useState({
color1: 'rgba(0, 255, 245, 1)', color1: 'rgba(0, 255, 245, 1)',
color:'rgba(255, 194, 20, 1)', color:'rgba(255, 194, 20, 1)',
yName:'℃', yName:'℃',
// areaColor0:'rgba(18, 255, 245, 0.4)', // areaColor0:'rgba(18, 255, 245, 0.4)',
areaColor1:'rgba(18, 255, 245, 0)', areaColor1:'rgba(18, 255, 245, 0)',
msg: kilnOptimize.topTempAvgFor1h, msg: kilnOptimize.topTempAvgFor1h,
modelFlag: null, modelFlag: value,
data: kilnOptimize.topTempAvgFor1h? kilnOptimize.topTempAvgFor1h.topTempAvgFor1h : [], data: kilnOptimize.topTempAvgFor1h? kilnOptimize.topTempAvgFor1h.topTempAvgFor1h : [],
range: [-10, 10] range: [-10, 10]
}); }
useEffect(() => {
setDataSource(prevDataSource => ({
...prevDataSource,
modelFlag: value
}));
}, [value]);
return ( return (
<BottomBarItem <BottomBarItem
icon="kilnBottom" icon="kilnBottom"

View File

@ -1,7 +1,7 @@
/* /*
* @Author: zhp * @Author: zhp
* @Date: 2024-08-23 14:44:30 * @Date: 2024-08-23 14:44:30
* @LastEditTime: 2024-08-30 16:56:21 * @LastEditTime: 2024-08-30 17:30:51
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
*/ */
@ -16,24 +16,17 @@ function LeftTopForecast(props) {
const value = useContext(HomeContext); const value = useContext(HomeContext);
const kilnOptimize = useSelector((state) => state.kilnOptimize); const kilnOptimize = useSelector((state) => state.kilnOptimize);
const [dataSource, setDataSource] = useState({ const dataSource = {
color1: 'rgba(0, 187, 255, 1)', color1: 'rgba(0, 187, 255, 1)',
color:'rgba(255, 194, 20, 1)', color:'rgba(255, 194, 20, 1)',
yName:'℃', yName:'℃',
// areaColor0:'rgba(18, 255, 245, 0.4)', // areaColor0:'rgba(18, 255, 245, 0.4)',
areaColor1:'rgba(18, 255, 245, 0)', areaColor1:'rgba(18, 255, 245, 0)',
msg: kilnOptimize.topTempAvgFor1h, msg: kilnOptimize.topTempAvgFor1h,
modelFlag: null, modelFlag: value,
data: kilnOptimize.topTempAvgFor1h? kilnOptimize.topTempAvgFor1h.topTempAvgFor1h : [], data: kilnOptimize.topTempAvgFor1h? kilnOptimize.topTempAvgFor1h.topTempAvgFor1h : [],
range: [-10, 10] range: [-10, 10]
}); }
useEffect(() => {
setDataSource(prevDataSource => ({
...prevDataSource,
modelFlag: value
}));
}, [value]);
return ( return (
<BottomBarItem <BottomBarItem
icon="kilnTop" icon="kilnTop"

View File

@ -13,13 +13,13 @@ function CommonChart(props) {
const color = dataSource.color || []; const color = dataSource.color || [];
const yName = dataSource.yName; const yName = dataSource.yName;
const xData = dataSource.xData || []; const xData = dataSource.xData || [];
console.log('xData',xData); console.log('xData',props);
let forecastList = []; let forecastList = [];
if (modelFlag === true) { if (modelFlag === true) {
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
let item = data[i]; let item = data[i];
let min = item - 5; let min = item - .5;
let max = item + 5; let max = item + .5;
let randomValue = Math.random() * (max - min) + min; let randomValue = Math.random() * (max - min) + min;
forecastList.push(randomValue.toFixed(1)); forecastList.push(randomValue.toFixed(1));
} }