From 466d9904486acf9d1d5082298f1541579fff262d Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期五, 09 七月 2021 12:24:11 +0800 Subject: [PATCH] 最后的版本 --- ZigbeeApp/Shared/Phone/MainPage/DeviceTemperatureHistoryForm.cs | 207 ++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 170 insertions(+), 37 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/MainPage/DeviceTemperatureHistoryForm.cs b/ZigbeeApp/Shared/Phone/MainPage/DeviceTemperatureHistoryForm.cs index c2cecf2..d4cc522 100644 --- a/ZigbeeApp/Shared/Phone/MainPage/DeviceTemperatureHistoryForm.cs +++ b/ZigbeeApp/Shared/Phone/MainPage/DeviceTemperatureHistoryForm.cs @@ -65,8 +65,14 @@ //鍥犱负鏇茬嚎鍥惧緢瀹�,鎵�浠ヤ娇鐢ㄥ乏鍙虫粦鍔ㄧ殑鎺т欢 this.horizontalScrolView = new HorizontalScrolViewLayout(); - horizontalScrolView.Y = Application.GetRealHeight(230); - horizontalScrolView.Height = bodyFrameLayout.Height - Application.GetRealHeight(230); +#if Android + horizontalScrolView.Y = Application.GetRealHeight(243); + horizontalScrolView.Height = bodyFrameLayout.Height - Application.GetRealHeight(243); +#endif +#if iOS + horizontalScrolView.Y = Application.GetRealHeight(300); + horizontalScrolView.Height = bodyFrameLayout.Height - Application.GetRealHeight(300); +#endif bodyFrameLayout.AddChidren(horizontalScrolView); //鍒濆鍖栫被鍒帶浠� @@ -170,23 +176,27 @@ }; } - //CO虏 - //frameCo2 = this.CreatTypeSelectControl("CO虏"); - //frameCo2.X = framePm.Right + defultSpace; - //frameCo2.ButtonClickEvent += (sender, e) => + //妫�娴嬭璁惧鏄惁鎷ユ湁CO虏鐨勫姛鑳� + //if (this.CheckDeviceHadCO2(myType) == true) //{ - // //鍚屼竴涓笢瑗�,涓嶅鐞� - // if (nowSelectObjType == 4) { return; } - // nowSelectObjType = 4; + // //CO虏 + // frameCo2 = this.CreatTypeSelectControl("CO虏"); + // frameCo2.X = framePm.Right + defultSpace; + // frameCo2.ButtonClickEvent += (sender, e) => + // { + // //鍚屼竴涓笢瑗�,涓嶅鐞� + // if (nowSelectObjType == 4) { return; } + // nowSelectObjType = 4; - // //璁剧疆閫夋嫨鎺т欢鐨勭姸鎬�(鍘熸潵鐨勫彉鏇翠负鍙栨秷) - // this.SetSelectControlStatu(nowBtnSelect, false, 0); - // nowBtnSelect = frameCo2.GetChildren(0) as NormalViewControl; - // //璁剧疆閫夋嫨鎺т欢鐨勭姸鎬�(褰撳墠鍙樻洿涓洪�夋嫨) - // this.SetSelectControlStatu(nowBtnSelect, true, 4); - // 鍒锋柊Echart鎺т欢 - // this.RefreshEchartControl(); - //}; + // //璁剧疆閫夋嫨鎺т欢鐨勭姸鎬�(鍘熸潵鐨勫彉鏇翠负鍙栨秷) + // this.SetSelectControlStatu(nowBtnSelect, false, 0); + // nowBtnSelect = frameCo2.GetChildren(0) as NormalViewControl; + // //璁剧疆閫夋嫨鎺т欢鐨勭姸鎬�(褰撳墠鍙樻洿涓洪�夋嫨) + // this.SetSelectControlStatu(nowBtnSelect, true, 4); + // //鍒锋柊Echart鎺т欢 + // this.RefreshEchartControl(); + // }; + //} //榛樿鍒濆閫夋嫨 if (frameTemperatrue != null) @@ -207,6 +217,12 @@ nowBtnSelect = framePm.GetChildren(0) as NormalViewControl; this.SetSelectControlStatu(nowBtnSelect, true, 3); } + //else if (frameCo2 != null) + //{ + // this.nowSelectObjType = 4; + // nowBtnSelect = frameCo2.GetChildren(0) as NormalViewControl; + // this.SetSelectControlStatu(nowBtnSelect, true, 4); + //} } /// <summary> @@ -301,7 +317,7 @@ dicText["3"] = "1" + Language.StringByID(R.MyInternationalizationString.uOneMonth1); var menuContr = new TextGroupMenuControl(dicText); - menuContr.Y = Application.GetRealHeight(100); + menuContr.Y = Application.GetRealHeight(98); bodyFrameLayout.AddChidren(menuContr); menuContr.SelectEvent += (selectKey, selectText) => { @@ -524,16 +540,16 @@ string mark = string.Empty; if (info.Hour == "0:00") { - mark = markTextSample.Replace("{0}", info.Day).Replace("{1}", "0:00~11:59").Replace("{2}", info.Value.ToString()); + mark = markTextSample.Replace("{0}", info.Day).Replace("{1}", "0:00~11:59").Replace("{2}", info.deValue.ToString()); } else { - mark = markTextSample.Replace("{0}", info.Day).Replace("{1}", "12:00~23:59").Replace("{2}", info.Value.ToString()); + mark = markTextSample.Replace("{0}", info.Day).Replace("{1}", "12:00~23:59").Replace("{2}", info.deValue.ToString()); } //鐗规畩澶勭悊PM2.5鐨勬樉绀� this.AdjustPM25TipText(ref mark, info.deValue); - valueText += "{value:" + info.Value + ",mark:" + mark + "},\r\n"; + valueText += "{value:" + info.deValue + ",mark:" + mark + "},\r\n"; } //娌℃湁鏁版嵁鍒欒缃负null else @@ -688,11 +704,11 @@ //鎸変互涓嬫牸寮忔樉绀� //2019-12-16 //婀垮害:68% - var mark = markTextSample.Replace("{0}", info.Day).Replace("{1}", string.Empty).Replace("{2}", info.Value.ToString()); + var mark = markTextSample.Replace("{0}", info.Day).Replace("{1}", string.Empty).Replace("{2}", info.deValue.ToString()); //鐗规畩澶勭悊PM2.5鐨勬樉绀� this.AdjustPM25TipText(ref mark, info.deValue); - valueText += "{value:" + info.Value + ",mark:" + mark + "},\r\n"; + valueText += "{value:" + info.deValue + ",mark:" + mark + "},\r\n"; } //娌℃湁鏁版嵁鍒欒缃负null else @@ -841,6 +857,7 @@ //{2}:Y杞寸殑鍗曚綅鏍煎紡 //{3}:X杞寸粍鍛樺搴旂殑鍊� //{4}:鏇茬嚎鐨勯鑹� +#if Android return @"{ color: ['#73A0FA', '#73DEB3', '#FFB761'], tooltip: { @@ -919,15 +936,106 @@ type: 'line', smooth: true, symbol:'emptyCircle', - symbolSize:8, + symbolSize:6, connectNulls:true, color:{4}, data: {3} } ] }"; +#endif +#if iOS + return @"{ + color: ['#73A0FA', '#73DEB3', '#FFB761'], + backgroundColor:'#f5f6fa', + tooltip: { + trigger: 'axis', + backgroundColor:'#777779', + axisPointer: { + type: 'line', + lineStyle: { + type: 'dashed', + color:{0} + } + }, + textStyle: { + fontSize: 36 + }, + formatter:function(pra){ + return pra[0].data.mark; } - + }, + dataZoom: + { + type: 'inside', + show: true, + start: 0, + end: 50 + }, + grid: { + left: '10', + right: '0', + bottom: '25', + top: '45', + containLabel: true + }, + xAxis: { + type: 'category', + boundaryGap:true, + axisLabel:{ + color: '#666666', + textStyle: { + fontSize: 30 + }, + }, + data: {1}, + splitLine: { + show: false + }, + axisTick: { + show: false + }, + axisLine: { + show: false + }, + }, + yAxis: { + type: 'value', + axisLabel: { + color: '#666666', + formatter:'{value}{2}', + textStyle: { + fontSize: 30 + }, + }, + splitLine: { + show: true, + lineStyle: { + color: '#CCCCCC', + width:1, + type:'dashed' + } + }, + axisTick: { + show: false + }, + axisLine: { + show: false + }, + }, + series: [{ + type: 'line', + smooth: true, + symbol:'emptyCircle', + symbolSize:15, + connectNulls:true, + color:{4}, + data: {3} + } + ] +}"; +#endif + } #endregion #region 鈻� 鑾峰彇浜戠鏁版嵁_______________________ @@ -945,10 +1053,10 @@ } gwMacmark = ZbGateway.GateWayBaseInfomations[this.device.CurrentGateWayId].MacMark; - //1026锛氭俯搴︼紱 1037锛欳o2锛� 1066锛歅M2.5锛� 1029锛氭俯搴� + //1026锛氭俯搴︼紱 1037锛欳o2锛� 1066锛歅M2.5锛� 1029锛氭箍搴� int dataType = 0; - if (this.nowSelectObjType == 1) { dataType = 1029; } - else if (this.nowSelectObjType == 2) { dataType = 1026; } + if (this.nowSelectObjType == 1) { dataType = 1026; } + else if (this.nowSelectObjType == 2) { dataType = 1029; } else if (this.nowSelectObjType == 3) { dataType = 1066; } else if (this.nowSelectObjType == 4) { dataType = 1037; } @@ -1112,6 +1220,12 @@ var text = Language.StringByID(R.MyInternationalizationString.uHumidity); return "'{0} {1}<br/>" + text + ":{2}" + this.GetEchartUint() + "<br/>{3}'"; } + //CO虏 + else if (this.nowSelectObjType == 4) + { + var text = "CO虏"; + return "'{0} {1}<br/>" + text + ":{2}" + this.GetEchartUint() + "'"; + } return "''"; } @@ -1212,44 +1326,63 @@ } /// <summary> + /// 妫�娴嬭璁惧鏄惁鎷ユ湁CO虏鐨勫姛鑳� + /// </summary> + /// <param name="enumInfo"></param> + /// <returns></returns> + private bool CheckDeviceHadCO2(DeviceEnumInfo enumInfo) + { + //PM2.5鍜岀┖姘旇川閲忎紶鎰熷櫒閮芥湁CO虏鐨勫姛鑳� + if (enumInfo.ConcreteType == DeviceConcreteType.Sensor_PMTwoPointFive + || enumInfo.ConcreteType == DeviceConcreteType.AirQualitySensor) + { + return true; + } + return false; + } + + /// <summary> /// 杞崲缁撴灉鍊� /// </summary> /// <param name="data"></param> private void ConvertHistoryDataValue(HistoryData data) { + //浜戠杩斿洖鐨勬暟鎹彲鑳藉甫灏忔暟鐐�,鎵�浠ラ渶瑕佹妸灏忔暟鐐圭粰鍘绘帀(寮鸿浆涓篿nt浼氭姤閿�) + int intValue = (int)Convert.ToDecimal(data.Value); //娓╁害,闇�瑕侀櫎浠�100(浼氬嚭鐜拌礋鏁�) if (this.nowSelectObjType == 1) { - int shortData = Convert.ToInt32(data.Value); - if (shortData > 32767) + if (intValue > 32767) { //璐熸暟(鐗规畩澶勭悊) - string strValue = (shortData - 65536).ToString(); + string strValue = (intValue - 65536).ToString(); //灏忔暟鐐归渶瑕佷竴浣�(鍏堟妸鏈�鍚庝竴浣嶅幓鎺�) strValue = strValue.Substring(0, strValue.Length - 1); //鐒跺悗鍐嶆彃鍏ヤ竴涓皬鏁扮偣 - data.deValue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + data.deValue = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); } else { //灏忔暟鐐归渶瑕佷竴浣�(鍏堟妸鏈�鍚庝竴浣嶅幓鎺�) - string strValue = data.Value.Substring(0, data.Value.Length - 1); + string strValue = intValue.ToString(); + strValue = strValue.Substring(0, strValue.Length - 1); //鐒跺悗鍐嶆彃鍏ヤ竴涓皬鏁扮偣 - data.deValue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + data.deValue = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); } } //婀垮害,闇�瑕侀櫎浠�100(涓嶄細鍑虹幇璐熸暟) else if (this.nowSelectObjType == 2) { //灏忔暟鐐归渶瑕佷竴浣�(鍏堟妸鏈�鍚庝竴浣嶅幓鎺�) - string strValue = data.Value.Substring(0, data.Value.Length - 1); + string strValue = intValue.ToString(); + strValue = strValue.Substring(0, strValue.Length - 1); //鐒跺悗鍐嶆彃鍏ヤ竴涓皬鏁扮偣 - data.deValue = Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); + data.deValue = strValue == string.Empty ? 0m : Convert.ToDecimal(strValue.Insert(strValue.Length - 1, ".")); } else { //鍏朵粬閮戒笉鐢ㄥ彉 - data.deValue = Convert.ToDecimal(data.Value); + data.deValue = Convert.ToDecimal(intValue); } } -- Gitblit v1.8.0