change - 温度曲线y轴数据修改

main
wenjy 3 years ago
parent cf66bbb742
commit d983773edd

@ -131,16 +131,6 @@ public class RecordSensorDataController {
recordStatisticalTemperature.setEndRecordTime(formatter.format(new Date()));
}
/*List<BaseSensorInfoDto> baseSensorInfoDtos =
baseSensorInfoService.selectBaseSensorInfoList(
new BaseSensorInfo(recordStatisticalTemperature.getSensorId()));
if (baseSensorInfoDtos.size() > 0) {
recordStatisticalTemperature.setMonitorunitId(
baseSensorInfoDtos.get(baseSensorInfoDtos.size() - 1).getMonitorunitId());
recordStatisticalTemperature.setSensorId(null);
}*/
String[] split = recordStatisticalTemperature.getSensorId().split(",");
List<RecordStatisticalTemperature> recordStatisticalTemperatureList = new ArrayList<>();
for (String s : split) {
@ -180,9 +170,18 @@ public class RecordSensorDataController {
series.add(seriesInfo);
}
}
BigDecimal minValue = null;
BigDecimal maxValue = null;
if(recordStatisticalTemperatureList.size() > 0){
RecordStatisticalTemperature recordStatisticalTemperature1 = recordStatisticalTemperatureList.stream().max(Comparator.comparing(RecordStatisticalTemperature::getSensorValue)).get();
RecordStatisticalTemperature recordStatisticalTemperature2 = recordStatisticalTemperatureList.stream().min(Comparator.comparing(RecordStatisticalTemperature::getSensorValue)).get();
minValue = recordStatisticalTemperature2.getSensorValue();
maxValue = recordStatisticalTemperature1.getSensorValue();
}
List<String> collect = xAxis.stream().distinct().collect(Collectors.toList());
Collections.sort(collect);
String s = JSONArray.toJSONString(new Root(legend, collect, series));
String s = JSONArray.toJSONString(new Root(minValue,maxValue,legend, collect, series));
return s;
}
@ -201,12 +200,18 @@ class Root {
public Root() {}
public Root(List<String> legend, List<String> xAxis, List<Series> series) {
public Root(BigDecimal minValue, BigDecimal maxValue, List<String> legend, List<String> xAxis, List<Series> series) {
this.minValue = minValue;
this.maxValue = maxValue;
this.legend = legend;
this.xAxis = xAxis;
this.series = series;
}
private BigDecimal minValue;
private BigDecimal maxValue;
private List<String> legend;
private List<String> xAxis;

@ -51,7 +51,7 @@
</select>
</li>
<li>
<label>传感器状态:</label>
<label>状态:</label>
<select name="sensorStatus" th:with="type=${@dict.getType('base_sensor_status')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"

@ -287,42 +287,6 @@
}
//echarts折线图
const lineCharts = function (res, id) {
let charts = echarts.init(id);
let options = {
tooltip: {
trigger: 'axis'
},
legend: {
data: res.legend
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: res.xAxis
},
yAxis: {
type: 'value'
},
series: res.series
};
charts.setOption(options);
$(window).resize(charts.resize);
}
const myEcharts = (res,ids) =>{
let charts = echarts.init(ids);
@ -383,9 +347,8 @@
color: "#000000",
},
},
min:20,
max:30,
interval: 1,
min:res.minValue,
max:res.maxValue,
},
],
dataZoom: [

Loading…
Cancel
Save