历史温度暂时提交

feasure-livedata
lld 2026-03-19 15:34:11 +08:00
parent d94d0f7a82
commit 3583296329
2 changed files with 33 additions and 6 deletions

View File

@ -4,7 +4,7 @@
<view>
<uni-row class="demo-uni-row" >
<uni-col :span="8">
<uni-data-select v-model="imei" :localdata="agriList" @change="changeAgri"></uni-data-select>
<uni-data-select style="background: #fff" v-model="imei" :localdata="agriList" @change="changeAgri"></uni-data-select>
</uni-col>
<uni-col :span="16">
@ -24,8 +24,13 @@
:canvas2d="true"
canvasId="nMPkeQGNEosMwoWKKNRBZBIEhguMoMWp"
:ontouch="true"
:disableScroll="true"
:onmovetip="true"
:onzoom="true"
tooltipFormat="tooltipDemo"
/>
<!-- 暂无数据 -->
</view>
</template>
@ -41,6 +46,12 @@ export default {
chartData: {},
// opts type="line" config-ucharts.js ['line'] opts
opts: {
legend: {
},
xAxis: {
rotateAngle: 75,
format: "xAxisDemo"
},
yAxis: {
gridType: "dash",
dashLength: 2,
@ -202,6 +213,9 @@ export default {
changeDate(date) {
// date[0]-date[1]
console.info("日期选择器:",date)
if (date[0] === date[1]) {
this.dateRange[0] = parseTime(date[0], '{y}-{m}-{d} 00:00:00')
}
if (this.imei) {
this.getServerData();
}
@ -214,6 +228,6 @@ export default {
/* 请根据实际需求修改父元素尺寸,组件自动识别宽高 */
.charts-box {
width: 100%;
height: 300px;
height: 500px;
}
</style>

View File

@ -57,8 +57,21 @@ const cfu = {
"yAxisDemo1":function(val, index, opts){return val+'元'},
"yAxisDemo2":function(val, index, opts){return val.toFixed(2)},
"xAxisDemo1":function(val, index, opts){return val+'年';},
"xAxisDemo":function(val, index, opts){
if (!val || typeof val === 'number' || !isNaN(val)) return "";
return val.split(" ")[1];
},
"xAxisDemo2":function(val, index, opts){return formatDateTime(val,'h:m')},
"seriesDemo1":function(val, index, series, opts){return val+'元'},
"tooltipDemo":function(item, category, index, opts){
if(index!==0) {
var unit = "%RH";
if (item.name.includes("温度")) {
unit = "℃";
}
return `${item.name}: ${item.data} ${unit}`
}
},
"tooltipDemo1":function(item, category, index, opts){
if(index==0){
return '随便用'+item.data+'年'
@ -329,14 +342,14 @@ const cfu = {
lineHeight: 20,
fontColor: "#FFFFFF",
legendShow: true,
legendShape: "auto",
splitLine: true,
legendShape: "square",
horizentalLine: false,
xAxisLabel: false,
splitLine: true,
xAxisLabel: true,
yAxisLabel: false,
labelBgColor: "#FFFFFF",
labelBgOpacity: 0.7,
labelFontColor: "#666666"
labelFontColor: "#ff0d0d"
},
markLine: {
type: "solid",