This commit is contained in:
‘937886381’ 2024-08-30 17:32:15 +08:00
parent f702e950ac
commit e4e9ba11c3
4 changed files with 17 additions and 38 deletions

View File

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

View File

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

View File

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

View File

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