| | |
| | | |
| | | //因为曲线图很宽,所以使用左右滑动的控件 |
| | | 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); |
| | | |
| | | //初始化类别控件 |
| | |
| | | }; |
| | | } |
| | | |
| | | //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) |
| | |
| | | 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> |
| | |
| | | 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) => |
| | | { |
| | |
| | | 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 |
| | |
| | | //按以下格式显示 |
| | | //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 |
| | |
| | | //{2}:Y轴的单位格式 |
| | | //{3}:X轴组员对应的值 |
| | | //{4}:曲线的颜色 |
| | | #if Android |
| | | return @"{ |
| | | color: ['#73A0FA', '#73DEB3', '#FFB761'], |
| | | tooltip: { |
| | |
| | | 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 ■ 获取云端数据_______________________ |
| | |
| | | } |
| | | gwMacmark = ZbGateway.GateWayBaseInfomations[this.device.CurrentGateWayId].MacMark; |
| | | |
| | | //1026:温度; 1037:Co2; 1066:PM2.5; 1029:温度 |
| | | //1026:温度; 1037:Co2; 1066:PM2.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; } |
| | | |
| | |
| | | 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 "''"; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /// <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) |
| | | { |
| | | //云端返回的数据可能带小数点,所以需要把小数点给去掉(强转为int会报错) |
| | | 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); |
| | | } |
| | | } |
| | | |