HDL-ON_Android/Assets/Language.ini | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL-ON_iOS/Resources/Language.ini | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/Common/R.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/HDL_ON.projitems | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3EnergyPage.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3SubloopEnergyPage.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_BrokenLine.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
HDL-ON_Android/Assets/Language.ini
@@ -671,6 +671,18 @@ 684=Length out of range 685=note: User management can only manage added users. If you need to add a new user, please go to the lock end for relevant operations. 686=Total 687=A-phase electricity data 688=B-phase electricity data 689=C-phase electricity data 690=Voltage 691=Current 692=Real-time power 693=Total electricity consumption (KW·h) 694=Hourly electricity consumption in the past 24 hours 695=Daily data of the past month 694=Monthly data of the past year @@ -2017,6 +2029,17 @@ 684=长度超出范围 685=注:用户管理仅可对已添加用户进行管理。如需添加新用户,请前往锁端进行相关操作。 686=总计 687=A相实时用电数据 688=B相实时用电数据 689=C相实时用电数据 690=电压 691=电流 692=实时功率 693=总用电量(KW·h) 694=过去24小时的每小时用电量 695=过去一个月的每日数据 694=过去一年的每月数据 @@ -3365,6 +3388,17 @@ 684=Length out of range 685=note: User management can only manage added users. If you need to add a new user, please go to the lock end for relevant operations. 686=Total 687=A-phase electricity data 688=B-phase electricity data 689=C-phase electricity data 690=Voltage 691=Current 692=Real-time power 693=Total electricity consumption (KW·h) 694=Hourly electricity consumption in the past 24 hours 695=Daily data of the past month 694=Monthly data of the past year @@ -4706,7 +4740,16 @@ 684=Length out of range 685=note: User management can only manage added users. If you need to add a new user, please go to the lock end for relevant operations. 686=Total 687=A-phase electricity data 688=B-phase electricity data 689=C-phase electricity data 690=Voltage 691=Current 692=Real-time power 693=Total electricity consumption (KW·h) 694=Hourly electricity consumption in the past 24 hours 695=Daily data of the past month 694=Monthly data of the past year @@ -6034,6 +6077,17 @@ 684=Length out of range 685=note: User management can only manage added users. If you need to add a new user, please go to the lock end for relevant operations. 686=Total 687=A-phase electricity data 688=B-phase electricity data 689=C-phase electricity data 690=Voltage 691=Current 692=Real-time power 693=Total electricity consumption (KW·h) 694=Hourly electricity consumption in the past 24 hours 695=Daily data of the past month 694=Monthly data of the past year HDL-ON_iOS/Resources/Language.ini
@@ -671,6 +671,18 @@ 684=Length out of range 685=note: User management can only manage added users. If you need to add a new user, please go to the lock end for relevant operations. 686=Total 687=A-phase electricity data 688=B-phase electricity data 689=C-phase electricity data 690=Voltage 691=Current 692=Real-time power 693=Total electricity consumption (KW·h) 694=Hourly electricity consumption in the past 24 hours 695=Daily data of the past month 694=Monthly data of the past year @@ -2017,6 +2029,17 @@ 684=长度超出范围 685=注:用户管理仅可对已添加用户进行管理。如需添加新用户,请前往锁端进行相关操作。 686=总计 687=A相实时用电数据 688=B相实时用电数据 689=C相实时用电数据 690=电压 691=电流 692=实时功率 693=总用电量(KW·h) 694=过去24小时的每小时用电量 695=过去一个月的每日数据 694=过去一年的每月数据 @@ -3365,6 +3388,17 @@ 684=Length out of range 685=note: User management can only manage added users. If you need to add a new user, please go to the lock end for relevant operations. 686=Total 687=A-phase electricity data 688=B-phase electricity data 689=C-phase electricity data 690=Voltage 691=Current 692=Real-time power 693=Total electricity consumption (KW·h) 694=Hourly electricity consumption in the past 24 hours 695=Daily data of the past month 694=Monthly data of the past year @@ -4706,7 +4740,16 @@ 684=Length out of range 685=note: User management can only manage added users. If you need to add a new user, please go to the lock end for relevant operations. 686=Total 687=A-phase electricity data 688=B-phase electricity data 689=C-phase electricity data 690=Voltage 691=Current 692=Real-time power 693=Total electricity consumption (KW·h) 694=Hourly electricity consumption in the past 24 hours 695=Daily data of the past month 694=Monthly data of the past year @@ -6034,6 +6077,17 @@ 684=Length out of range 685=note: User management can only manage added users. If you need to add a new user, please go to the lock end for relevant operations. 686=Total 687=A-phase electricity data 688=B-phase electricity data 689=C-phase electricity data 690=Voltage 691=Current 692=Real-time power 693=Total electricity consumption (KW·h) 694=Hourly electricity consumption in the past 24 hours 695=Daily data of the past month 694=Monthly data of the past year HDL_ON/Common/R.cs
@@ -4,11 +4,46 @@ { public static class StringId { /// <summary> /// 过去一年的每月数据 /// </summary> public const int AirSwitchP3HistroyTip3 = 696; /// <summary> /// 过去一个月的每日数据 /// </summary> public const int AirSwitchP3HistroyTip2 = 695; /// <summary> /// 过去24小时的每小时用电量 /// </summary> public const int AirSwitchP3HistroyTip1 = 694; /// <summary> /// 总用电量(KW·h) /// </summary> public const int TotalPowerAndUnit = 693; /// <summary> /// 实时功率 /// </summary> public const int ActivePower = 692; /// <summary> /// 电流 /// </summary> public const int Current = 691; /// <summary> /// 电压 /// </summary> public const int Voltage = 690; /// <summary> /// C相实时用电数据 /// </summary> public const int RealTimeElectricityConsumptionDataOfPhaseC = 689; /// <summary> /// B相实时用电数据 /// </summary> public const int RealTimeElectricityConsumptionDataOfPhaseB = 688; /// <summary> /// A相实时用电数据 /// </summary> public const int RealTimeElectricityConsumptionDataOfPhaseA = 687; /// <summary> /// 总计 /// </summary> HDL_ON/HDL_ON.projitems
@@ -564,6 +564,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\2-Classification\SeriesFunctionListPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\AirSwitchP3Page.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\AirSwitchP3EnergyPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Electrical\AirSwitchP3SubloopEnergyPage.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs
@@ -37,10 +37,10 @@ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; break; case SPK.AirSwitchP3: //var airSwitchP3Page = new AirSwitchP3Page(function); //MainPage.BasePageView.AddChidren(airSwitchP3Page); //airSwitchP3Page.LoadPage(btnCollectionIcon, btnName, btnFromFloor); //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; var airSwitchP3Page = new AirSwitchP3Page(function); MainPage.BasePageView.AddChidren(airSwitchP3Page); airSwitchP3Page.LoadPage(btnCollectionIcon, btnName, btnFromFloor); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; break; case SPK.LightSwitch: var relayView = new RelayPage(function); HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3EnergyPage.cs
@@ -15,19 +15,10 @@ static AirSwitchP3EnergyPage bodyView; /// <summary> /// 总功耗-饼图 /// </summary> MyEchartsViewOn myEchartsView_Pie; /// <summary> /// 曲线图数据string /// </summary> EchartsOption_BrokenLine brokenLine; /// <summary> /// 插查询的能源列表 /// </summary> List<Function> queryList = new List<Function>(); /// <summary> /// 查询条件 /// hour、week、month @@ -35,10 +26,6 @@ string curQueryType = "hour"; /// <summary> /// 能源列表区域 /// </summary> FrameLayout energyListView; /// <summary> /// 历史数据图表 /// </summary> @@ -69,6 +56,7 @@ Y = Application.GetRealHeight(64), Height = Application.GetRealHeight(667-64), BackgroundColor = 0xFFF5F7FA, ScrollEnabled = false, }; bodyView.AddChidren(contentView); @@ -165,6 +153,12 @@ btnShowHistroyData_Total.MouseUpEventHandler = (sender, e) => { if(curQueryType == "total") { return; } curQueryType = "total"; (sender as Button).SelectedBackgroundColor = 0x1F5C62FE; (sender as Button).BackgroundColor = 0x1F5C62FE; (sender as Button).BorderColor = CSS_Color.MainColor; @@ -188,11 +182,16 @@ btnShowHistroyData_Day.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Day.BackgroundColor = 0x00000000; btnShowHistroyData_Day.SelectedBackgroundColor = 0x00000000; }; }; btnShowHistroyData_Day.MouseUpEventHandler = (sender, e) => { if(curQueryType == "hour") { return; } (sender as Button).SelectedBackgroundColor = 0x1F5C62FE; (sender as Button).BackgroundColor = 0x1F5C62FE; (sender as Button).BorderColor = CSS_Color.MainColor; @@ -216,10 +215,18 @@ btnShowHistroyData_Total.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Total.BackgroundColor = 0x00000000; btnShowHistroyData_Total.SelectedBackgroundColor = 0x00000000; curQueryType = "hour"; brokenLine.YvalueText = ""; LoadMothed_GetHistoryData(); }; btnShowHistroyData_Month.MouseUpEventHandler = (sender, e) => { if(curQueryType == "month") { return; } (sender as Button).SelectedBackgroundColor = 0x1F5C62FE; (sender as Button).BackgroundColor = 0x1F5C62FE; (sender as Button).BorderColor = CSS_Color.MainColor; @@ -243,10 +250,19 @@ btnShowHistroyData_Total.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Total.BackgroundColor = 0x00000000; btnShowHistroyData_Total.SelectedBackgroundColor = 0x00000000; curQueryType = "month"; brokenLine.YvalueText = ""; LoadMothed_GetHistoryData(); }; btnShowHistroyData_Year.MouseUpEventHandler = (sender, e) => { if(curQueryType == "year_month") { return; } (sender as Button).SelectedBackgroundColor = 0x1F5C62FE; (sender as Button).BackgroundColor = 0x1F5C62FE; (sender as Button).BorderColor = CSS_Color.MainColor; @@ -270,6 +286,11 @@ btnShowHistroyData_Total.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Total.BackgroundColor = 0x00000000; btnShowHistroyData_Total.SelectedBackgroundColor = 0x00000000; curQueryType = "year_month"; brokenLine.YvalueText = ""; LoadMothed_GetHistoryData(); }; #endregion @@ -284,6 +305,8 @@ Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealWidth(330), Radius = (uint)Application.GetRealWidth(16), BackgroundColor = CSS_Color.MainBackgroundColor, }; contentView.AddChidren(historyDataView); @@ -294,9 +317,237 @@ }; historyDataView.AddChidren(myEchartsView_Line); //EnergyRow(energy, energyListView, index); var btnTip = new Button() { Y = Application.GetRealHeight(289), Height = Application.GetRealHeight(41), Width = Application.GetRealWidth(300), TextAlignment = TextAlignment.Center, Gravity = Gravity.CenterHorizontal, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextColor = CSS_Color.FirstLevelTitleColor, TextID = StringId.AirSwitchP3HistroyTip1, }; historyDataView.AddChidren(btnTip); LoadMothed_GetHistoryData(); #region A contentView.AddChidren(new Button() { Height = Application.GetRealHeight(12), }); var viewa = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(52), BackgroundColor = CSS_Color.MainBackgroundColor, Radius = (uint)Application.GetRealWidth(12), }; contentView.AddChidren(viewa); Button btnRighta = new Button() { X = Application.GetRealWidth(321), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; viewa.AddChidren(btnRighta); Button btnTitlea = new Button() { X = Application.GetRealWidth(16), TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.TextFontSize, TextColor= 0xFF000000, Width = Application.GetRealWidth(300), TextID = StringId.RealTimeElectricityConsumptionDataOfPhaseA }; viewa.AddChidren(btnTitlea); #endregion #region B contentView.AddChidren(new Button() { Height = Application.GetRealHeight(12), }); var viewb = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(52), BackgroundColor = CSS_Color.MainBackgroundColor, Radius = (uint)Application.GetRealWidth(12), }; contentView.AddChidren(viewb); Button btnRightb = new Button() { X = Application.GetRealWidth(321), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; viewb.AddChidren(btnRightb); Button btnTitleb = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(300), TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.TextFontSize, TextColor = 0xFF000000, TextID = StringId.RealTimeElectricityConsumptionDataOfPhaseB, }; viewb.AddChidren(btnTitleb); #endregion #region C contentView.AddChidren(new Button() { Height = Application.GetRealHeight(12), }); var viewc = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(52), BackgroundColor = CSS_Color.MainBackgroundColor, Radius = (uint)Application.GetRealWidth(12), }; contentView.AddChidren(viewc); Button btnRightc = new Button() { X = Application.GetRealWidth(321), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(16), Height = Application.GetMinRealAverage(16), UnSelectedImagePath = "Public/Right.png", }; viewc.AddChidren(btnRightc); Button btnTitlec = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(300), TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.TextFontSize, TextColor = 0xFF000000, TextID = StringId.RealTimeElectricityConsumptionDataOfPhaseC, }; viewc.AddChidren(btnTitlec); #endregion btnTitlea.MouseUpEventHandler = (sender, e) => { var skipView = new AirSwitchP3SubloopEnergyPage(device,FunctionAttributeKey.ElectricityA); MainPage.BasePageView.AddChidren(skipView); skipView.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; btnTitlea.MouseUpEventHandler = (sender, e) => { var skipView = new AirSwitchP3SubloopEnergyPage(device, FunctionAttributeKey.ElectricityB); MainPage.BasePageView.AddChidren(skipView); skipView.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; btnTitlea.MouseUpEventHandler = (sender, e) => { var skipView = new AirSwitchP3SubloopEnergyPage(device, FunctionAttributeKey.ElectricityC); MainPage.BasePageView.AddChidren(skipView); skipView.LoadPage(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; #region 总用电量 var totalElectricityView = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealWidth(183), Radius = (uint)Application.GetRealWidth(16), BackgroundColor = CSS_Color.MainBackgroundColor, }; //historyDataView.AddChidren(totalElectricityView); var btnTotalElectricity = new Button() { Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(55), X = Application.GetRealWidth(14), TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextColor = 0xFF030D1C, TextAlignment = TextAlignment.CenterLeft, TextID = StringId.TotalPowerAndUnit, }; totalElectricityView.AddChidren(btnTotalElectricity); var btnTotalNumber = new Button() { Y = Application.GetRealHeight(27), Gravity = Gravity.CenterHorizontal, Height = Application.GetRealHeight(167), TextSize = 49, TextColor = 0xFF030D1C, TextAlignment = TextAlignment.Center, Text = device.GetAttrState(FunctionAttributeKey.TotalElectricity), }; totalElectricityView.AddChidren(btnTotalNumber); btnShowHistroyData_Day.MouseUpEventHandler += (sender, e) => { totalElectricityView.RemoveFromParent(); historyDataView.AddChidren(myEchartsView_Line); viewa.Visible = true; viewb.Visible = true; viewc.Visible = true; btnTip.TextID = StringId.AirSwitchP3HistroyTip1; historyDataView.Height = Application.GetRealHeight(330); }; btnShowHistroyData_Month.MouseUpEventHandler += (sender, e) => { totalElectricityView.RemoveFromParent(); historyDataView.AddChidren(myEchartsView_Line); viewa.Visible = true; viewb.Visible = true; viewc.Visible = true; btnTip.TextID = StringId.AirSwitchP3HistroyTip2; historyDataView.Height = Application.GetRealHeight(330); }; btnShowHistroyData_Year.MouseUpEventHandler += (sender, e) => { totalElectricityView.RemoveFromParent(); historyDataView.AddChidren(myEchartsView_Line); viewa.Visible = false; viewb.Visible = false; viewc.Visible = false; btnTip.TextID = StringId.AirSwitchP3HistroyTip3; historyDataView.Height = Application.GetRealHeight(330); }; btnShowHistroyData_Total.MouseUpEventHandler += (sender, e) => { myEchartsView_Line.RemoveFromParent(); historyDataView.AddChidren(totalElectricityView); viewa.Visible = false; viewb.Visible = false; viewc.Visible = false; historyDataView.Height = Application.GetRealHeight(184); }; #endregion } @@ -337,10 +588,25 @@ "813","313","213","123", "113","213","183","133", "133","513","133","413", "813","313","213","123", "113","213","183","133", "133","513","133","413", }; brokenLine.InitXdataText(vs); revertData = new List<EnvironmentalSensorHistor>() { new EnvironmentalSensorHistor{ fieldValue = "100"}, new EnvironmentalSensorHistor{ fieldValue = "200"}, new EnvironmentalSensorHistor{ fieldValue = "300"}, new EnvironmentalSensorHistor{ fieldValue = "400"}, new EnvironmentalSensorHistor{ fieldValue = "500"}, new EnvironmentalSensorHistor{ fieldValue = "400"}, new EnvironmentalSensorHistor{ fieldValue = "100"}, new EnvironmentalSensorHistor{ fieldValue = "200"}, new EnvironmentalSensorHistor{ fieldValue = "300"}, new EnvironmentalSensorHistor{ fieldValue = "400"}, new EnvironmentalSensorHistor{ fieldValue = "500"}, new EnvironmentalSensorHistor{ fieldValue = "400"}, new EnvironmentalSensorHistor{ fieldValue = "100"}, new EnvironmentalSensorHistor{ fieldValue = "200"}, new EnvironmentalSensorHistor{ fieldValue = "300"}, @@ -358,7 +624,7 @@ { device.attributes.Add(new FunctionAttributes() { key = "ydata" }); } device.SetAttrState("ydata", brokenLine.InitYdataText(device.name, revertData, "#5C62FE") + ", "); device.SetAttrState("ydata", brokenLine.InitYdataText2(device.name, revertData, "#5C62FE", curQueryType == "year_month") + ", "); #endif } @@ -377,18 +643,18 @@ { device.attributes.Add(new FunctionAttributes() { key = "ydata" }); } device.SetAttrState("ydata", brokenLine.InitYdataText(device.name, revertData, "#5C62FE") + ", "); device.SetAttrState("ydata", brokenLine.InitYdataText2(device.name, revertData, "#5C62FE", curQueryType == "year_month") + ", "); } } } brokenLine.yTitle = Language.StringByID(StringId.EnergyConsumption) + "(kW)"; brokenLine.yTitle = Language.StringByID(StringId.Uint) + "(KW·h)"; brokenLine.xTitle = Language.StringByID(StringId.timeMode); if (curQueryType != "hour") { brokenLine.xTitle = Language.StringByID(StringId.Date); } var opString = brokenLine.InitOption(30); var opString = brokenLine.InitOption(50, curQueryType == "year_month"); Application.RunOnMainThread(() => { myEchartsView_Line.ShowWithOption(opString); HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3SubloopEnergyPage.cs
New file @@ -0,0 +1,664 @@ using System; using System.Collections.Generic; using HDL_ON.DAL.Server; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI { /// <summary> /// 三相空开子相历史数据界面 /// </summary> public class AirSwitchP3SubloopEnergyPage : FrameLayout { static AirSwitchP3SubloopEnergyPage bodyView; /// <summary> /// 曲线图数据string /// </summary> EchartsOption_BrokenLine brokenLine; /// <summary> /// 查询条件 /// hour、week、month /// </summary> string curQueryType = "hour"; /// <summary> /// 历史数据图表 /// </summary> MyEchartsViewOn myEchartsView_Line; Function device; string key = ""; /// <summary> /// 主页 /// </summary> public AirSwitchP3SubloopEnergyPage(Function function,string searchKey) { bodyView = this; this.key = searchKey; device = function; } /// <summary> /// /// </summary> public void LoadPage() { new TopViewDiv(bodyView, Language.StringByID(StringId.EnergyMonitoring)).LoadTopView(0xFFF7F7F7); bodyView.BackgroundColor = 0xFFF5F7FA; var contentView = new VerticalScrolViewLayout() { Y = Application.GetRealHeight(64), Height = Application.GetRealHeight(667 - 64), BackgroundColor = 0xFFF5F7FA, ScrollEnabled = false, }; bodyView.AddChidren(contentView); contentView.AddChidren(new Button() { Height = Application.GetRealHeight(12), }); brokenLine = new EchartsOption_BrokenLine(); #region A contentView.AddChidren(new Button() { Height = Application.GetRealHeight(12), }); var viewa = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(52), BackgroundColor = CSS_Color.MainBackgroundColor, Radius = (uint)Application.GetRealWidth(12), }; contentView.AddChidren(viewa); Button btnRighta = new Button() { X = Application.GetRealWidth(221), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(116), TextAlignment = TextAlignment.CenterRight, TextColor = 0xFF768194, TextSize = CSS_FontSize.TextFontSize, Text = "---V", }; viewa.AddChidren(btnRighta); Button btnTitlea = new Button() { X = Application.GetRealWidth(16), TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.TextFontSize, TextColor = 0xFF000000, Width = Application.GetRealWidth(300), TextID = StringId.Voltage }; viewa.AddChidren(btnTitlea); #endregion #region B contentView.AddChidren(new Button() { Height = Application.GetRealHeight(12), }); var viewb = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(52), BackgroundColor = CSS_Color.MainBackgroundColor, Radius = (uint)Application.GetRealWidth(12), }; contentView.AddChidren(viewb); Button btnRightb = new Button() { X = Application.GetRealWidth(221), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(116), TextAlignment = TextAlignment.CenterRight, TextColor = 0xFF768194, TextSize = CSS_FontSize.TextFontSize, Text = "---A", }; viewb.AddChidren(btnRightb); Button btnTitleb = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(300), TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.TextFontSize, TextColor = 0xFF000000, TextID = StringId.Current, }; viewb.AddChidren(btnTitleb); #endregion #region C contentView.AddChidren(new Button() { Height = Application.GetRealHeight(12), }); var viewc = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(52), BackgroundColor = CSS_Color.MainBackgroundColor, Radius = (uint)Application.GetRealWidth(12), }; contentView.AddChidren(viewc); Button btnRightc = new Button() { X = Application.GetRealWidth(221), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(116), TextAlignment = TextAlignment.CenterRight, TextColor = 0xFF768194, TextSize = CSS_FontSize.TextFontSize, Text = "---W", }; viewc.AddChidren(btnRightc); Button btnTitlec = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(300), TextAlignment = TextAlignment.CenterLeft, TextSize = CSS_FontSize.TextFontSize, TextColor = 0xFF000000, TextID = StringId.ActivePower, }; viewc.AddChidren(btnTitlec); #endregion contentView.AddChidren(new Button() { Height = Application.GetRealHeight(26), }); #region 选择数据日期范围 var showDataTypeView = new FrameLayout() { X = Application.GetRealWidth(143), Y = Application.GetRealHeight(12), Width = Application.GetRealWidth(216), Height = Application.GetRealHeight(27), //BackgroundImagePath = "FunctionIcon/EnvironmentalScience/SensorHistoryBg1.png", }; contentView.AddChidren(showDataTypeView); var btnShowHistroyData_Day = new Button() { Width = Application.GetRealWidth(54), Height = Application.GetRealHeight(27), TextAlignment = TextAlignment.Center, TextColor = CSS_Color.PromptingColor1, SelectedTextColor = CSS_Color.MainColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, IsSelected = true, TextID = StringId.day, SelectedBackgroundColor = 0x1F5C62FE, BackgroundColor = 0x1F5C62FE, BorderColor = CSS_Color.MainColor, BorderWidth = 2, }; showDataTypeView.AddChidren(btnShowHistroyData_Day); btnShowHistroyData_Day.SetCornerWithSameRadius((uint)Application.GetRealHeight(6), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerBottomLeft); var btnShowHistroyData_Month = new Button() { X = Application.GetRealWidth(54), Width = Application.GetRealWidth(54), TextAlignment = TextAlignment.Center, TextColor = CSS_Color.PromptingColor1, SelectedTextColor = CSS_Color.MainColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextID = StringId.month, SelectedBackgroundColor = 0x1F5C62FE, BackgroundColor = 0x00000000, IsSelected = false, BorderWidth = 1, BorderColor = CSS_Color.PromptingColor1, }; showDataTypeView.AddChidren(btnShowHistroyData_Month); var btnShowHistroyData_Year = new Button() { X = Application.GetRealWidth(54 * 2), Width = Application.GetRealWidth(54), TextAlignment = TextAlignment.Center, TextColor = CSS_Color.PromptingColor1, SelectedTextColor = CSS_Color.MainColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextID = StringId.Years, SelectedBackgroundColor = 0x1F5C62FE, BackgroundColor = 0x00000000, IsSelected = false, BorderWidth = 1, BorderColor = CSS_Color.PromptingColor1, }; showDataTypeView.AddChidren(btnShowHistroyData_Year); var btnShowHistroyData_Total = new Button() { X = Application.GetRealWidth(54 * 3), Width = Application.GetRealWidth(54), TextAlignment = TextAlignment.Center, TextColor = CSS_Color.PromptingColor1, SelectedTextColor = CSS_Color.MainColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextID = StringId.Total, SelectedBackgroundColor = 0x1F5C62FE, BackgroundColor = 0x00000000, IsSelected = false, BorderWidth = 1, BorderColor = CSS_Color.PromptingColor1, }; showDataTypeView.AddChidren(btnShowHistroyData_Total); btnShowHistroyData_Total.SetCornerWithSameRadius((uint)Application.GetRealHeight(6), HDLUtils.RectCornerBottomRight | HDLUtils.RectCornerTopRight); btnShowHistroyData_Total.MouseUpEventHandler = (sender, e) => { if (curQueryType == "total") { return; } curQueryType = "total"; (sender as Button).SelectedBackgroundColor = 0x1F5C62FE; (sender as Button).BackgroundColor = 0x1F5C62FE; (sender as Button).BorderColor = CSS_Color.MainColor; (sender as Button).BorderWidth = 2; (sender as Button).IsSelected = true; btnShowHistroyData_Month.IsSelected = false; btnShowHistroyData_Month.BorderWidth = 1; btnShowHistroyData_Month.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Month.BackgroundColor = 0x00000000; btnShowHistroyData_Month.SelectedBackgroundColor = 0x00000000; btnShowHistroyData_Year.IsSelected = false; btnShowHistroyData_Year.BorderWidth = 1; btnShowHistroyData_Year.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Year.BackgroundColor = 0x00000000; btnShowHistroyData_Year.SelectedBackgroundColor = 0x00000000; btnShowHistroyData_Day.IsSelected = false; btnShowHistroyData_Day.BorderWidth = 1; btnShowHistroyData_Day.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Day.BackgroundColor = 0x00000000; btnShowHistroyData_Day.SelectedBackgroundColor = 0x00000000; }; btnShowHistroyData_Day.MouseUpEventHandler = (sender, e) => { if (curQueryType == "hour") { return; } (sender as Button).SelectedBackgroundColor = 0x1F5C62FE; (sender as Button).BackgroundColor = 0x1F5C62FE; (sender as Button).BorderColor = CSS_Color.MainColor; (sender as Button).BorderWidth = 2; (sender as Button).IsSelected = true; btnShowHistroyData_Month.IsSelected = false; btnShowHistroyData_Month.BorderWidth = 1; btnShowHistroyData_Month.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Month.BackgroundColor = 0x00000000; btnShowHistroyData_Month.SelectedBackgroundColor = 0x00000000; btnShowHistroyData_Year.IsSelected = false; btnShowHistroyData_Year.BorderWidth = 1; btnShowHistroyData_Year.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Year.BackgroundColor = 0x00000000; btnShowHistroyData_Year.SelectedBackgroundColor = 0x00000000; btnShowHistroyData_Total.IsSelected = false; btnShowHistroyData_Total.BorderWidth = 1; btnShowHistroyData_Total.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Total.BackgroundColor = 0x00000000; btnShowHistroyData_Total.SelectedBackgroundColor = 0x00000000; curQueryType = "hour"; brokenLine.YvalueText = ""; LoadMothed_GetHistoryData(); }; btnShowHistroyData_Month.MouseUpEventHandler = (sender, e) => { if (curQueryType == "month") { return; } (sender as Button).SelectedBackgroundColor = 0x1F5C62FE; (sender as Button).BackgroundColor = 0x1F5C62FE; (sender as Button).BorderColor = CSS_Color.MainColor; (sender as Button).BorderWidth = 2; (sender as Button).IsSelected = true; btnShowHistroyData_Day.IsSelected = false; btnShowHistroyData_Day.BorderWidth = 1; btnShowHistroyData_Day.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Day.BackgroundColor = 0x00000000; btnShowHistroyData_Day.SelectedBackgroundColor = 0x00000000; btnShowHistroyData_Year.IsSelected = false; btnShowHistroyData_Year.BorderWidth = 1; btnShowHistroyData_Year.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Year.BackgroundColor = 0x00000000; btnShowHistroyData_Year.SelectedBackgroundColor = 0x00000000; btnShowHistroyData_Total.IsSelected = false; btnShowHistroyData_Total.BorderWidth = 1; btnShowHistroyData_Total.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Total.BackgroundColor = 0x00000000; btnShowHistroyData_Total.SelectedBackgroundColor = 0x00000000; curQueryType = "month"; brokenLine.YvalueText = ""; LoadMothed_GetHistoryData(); }; btnShowHistroyData_Year.MouseUpEventHandler = (sender, e) => { if (curQueryType == "year_month") { return; } (sender as Button).SelectedBackgroundColor = 0x1F5C62FE; (sender as Button).BackgroundColor = 0x1F5C62FE; (sender as Button).BorderColor = CSS_Color.MainColor; (sender as Button).BorderWidth = 2; (sender as Button).IsSelected = true; btnShowHistroyData_Month.IsSelected = false; btnShowHistroyData_Month.BorderWidth = 1; btnShowHistroyData_Month.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Month.BackgroundColor = 0x00000000; btnShowHistroyData_Month.SelectedBackgroundColor = 0x00000000; btnShowHistroyData_Day.IsSelected = false; btnShowHistroyData_Day.BorderWidth = 1; btnShowHistroyData_Day.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Day.BackgroundColor = 0x00000000; btnShowHistroyData_Day.SelectedBackgroundColor = 0x00000000; btnShowHistroyData_Total.IsSelected = false; btnShowHistroyData_Total.BorderWidth = 1; btnShowHistroyData_Total.BorderColor = CSS_Color.PromptingColor1; btnShowHistroyData_Total.BackgroundColor = 0x00000000; btnShowHistroyData_Total.SelectedBackgroundColor = 0x00000000; curQueryType = "year_month"; brokenLine.YvalueText = ""; LoadMothed_GetHistoryData(); }; #endregion contentView.AddChidren(new Button() { Height = Application.GetRealHeight(12), }); var historyDataView = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealWidth(330), Radius = (uint)Application.GetRealWidth(16), BackgroundColor = CSS_Color.MainBackgroundColor, }; contentView.AddChidren(historyDataView); myEchartsView_Line = new MyEchartsViewOn() { Y = Application.GetRealWidth(10), Height = Application.GetRealWidth(280), }; historyDataView.AddChidren(myEchartsView_Line); //EnergyRow(energy, energyListView, index); LoadMothed_GetHistoryData(); #region 总用电量 var totalElectricityView = new FrameLayout() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealWidth(183), Radius = (uint)Application.GetRealWidth(16), BackgroundColor = CSS_Color.MainBackgroundColor, }; //historyDataView.AddChidren(totalElectricityView); var btnTotalElectricity = new Button() { Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(55), X = Application.GetRealWidth(14), TextSize = CSS_FontSize.PromptFontSize_FirstLevel, TextColor = 0xFF030D1C, TextAlignment = TextAlignment.CenterLeft, TextID = StringId.TotalPowerAndUnit, }; totalElectricityView.AddChidren(btnTotalElectricity); var btnTotalNumber = new Button() { Y = Application.GetRealHeight(27), Gravity = Gravity.CenterHorizontal, Height = Application.GetRealHeight(167), TextSize = 49, TextColor = 0xFF030D1C, TextAlignment = TextAlignment.Center, Text = device.GetAttrState(FunctionAttributeKey.TotalElectricity), }; totalElectricityView.AddChidren(btnTotalNumber); btnShowHistroyData_Day.MouseUpEventHandler += (sender, e) => { totalElectricityView.RemoveFromParent(); historyDataView.AddChidren(myEchartsView_Line); //viewa.Visible = true; //viewb.Visible = true; //viewc.Visible = true; historyDataView.Height = Application.GetRealHeight(330); }; btnShowHistroyData_Month.MouseUpEventHandler += (sender, e) => { totalElectricityView.RemoveFromParent(); historyDataView.AddChidren(myEchartsView_Line); //viewa.Visible = true; //viewb.Visible = true; //viewc.Visible = true; historyDataView.Height = Application.GetRealHeight(330); }; btnShowHistroyData_Year.MouseUpEventHandler += (sender, e) => { totalElectricityView.RemoveFromParent(); historyDataView.AddChidren(myEchartsView_Line); //viewa.Visible = true; //viewb.Visible = true; //viewc.Visible = true; historyDataView.Height = Application.GetRealHeight(330); }; btnShowHistroyData_Total.MouseUpEventHandler += (sender, e) => { myEchartsView_Line.RemoveFromParent(); historyDataView.AddChidren(totalElectricityView); //viewa.Visible = false; //viewb.Visible = false; //viewc.Visible = false; historyDataView.Height = Application.GetRealHeight(184); }; #endregion } /// <summary> /// 读取历史数据 /// </summary> void LoadMothed_GetHistoryData() { var loadPage = new Loading() { LodingBackgroundColor = 0x88888888, }; bodyView.AddChidren(loadPage); new System.Threading.Thread(() => { try { Application.RunOnMainThread(() => { loadPage.Start(Language.StringByID(StringId.PleaseWait)); }); var sensorType = device.spk.Split(".")[1]; var revertObj = new HttpServerRequest().GetSensorHistory(curQueryType, device.deviceId, key); if (revertObj != null) { if (revertObj.Code == StateCode.SUCCESS) { var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EnvironmentalSensorHistor>>(revertObj.Data.ToString()); if (revertData == null || revertData.Count == 0) { #if DEBUG List<string> vs = new List<string>() { "813","313","213","123", "113","213","183","133", "133","513","133","413", "813","313","213","123", "113","213","183","133", "133","513","133","413", }; brokenLine.InitXdataText(vs); revertData = new List<EnvironmentalSensorHistor>() { new EnvironmentalSensorHistor{ fieldValue = "100"}, new EnvironmentalSensorHistor{ fieldValue = "200"}, new EnvironmentalSensorHistor{ fieldValue = "300"}, new EnvironmentalSensorHistor{ fieldValue = "400"}, new EnvironmentalSensorHistor{ fieldValue = "500"}, new EnvironmentalSensorHistor{ fieldValue = "400"}, new EnvironmentalSensorHistor{ fieldValue = "100"}, new EnvironmentalSensorHistor{ fieldValue = "200"}, new EnvironmentalSensorHistor{ fieldValue = "300"}, new EnvironmentalSensorHistor{ fieldValue = "400"}, new EnvironmentalSensorHistor{ fieldValue = "500"}, new EnvironmentalSensorHistor{ fieldValue = "400"}, new EnvironmentalSensorHistor{ fieldValue = "100"}, new EnvironmentalSensorHistor{ fieldValue = "200"}, new EnvironmentalSensorHistor{ fieldValue = "300"}, new EnvironmentalSensorHistor{ fieldValue = "400"}, new EnvironmentalSensorHistor{ fieldValue = "500"}, new EnvironmentalSensorHistor{ fieldValue = "400"}, new EnvironmentalSensorHistor{ fieldValue = "100"}, new EnvironmentalSensorHistor{ fieldValue = "200"}, new EnvironmentalSensorHistor{ fieldValue = "300"}, new EnvironmentalSensorHistor{ fieldValue = "400"}, new EnvironmentalSensorHistor{ fieldValue = "500"}, new EnvironmentalSensorHistor{ fieldValue = "400"}, }; if (device.GetAttribute("ydata") == null) { device.attributes.Add(new FunctionAttributes() { key = "ydata" }); } device.SetAttrState("ydata", brokenLine.InitYdataText2(device.name, revertData, "#5C62FE", curQueryType == "year_month") + ", "); #endif } else { List<string> vs = new List<string>(); if (brokenLine.YvalueText == "") { foreach (var data in revertData) { vs.Add(data.fieldName); } brokenLine.InitXdataText(vs); } if (device.GetAttribute("ydata") == null) { device.attributes.Add(new FunctionAttributes() { key = "ydata" }); } device.SetAttrState("ydata", brokenLine.InitYdataText2(device.name, revertData, "#5C62FE", curQueryType == "year_month") + ", "); } } } brokenLine.yTitle = Language.StringByID(StringId.Uint) + "(KW·h)"; brokenLine.xTitle = Language.StringByID(StringId.timeMode); if (curQueryType != "hour") { brokenLine.xTitle = Language.StringByID(StringId.Date); } var opString = brokenLine.InitOption(50, curQueryType == "year_month"); Application.RunOnMainThread(() => { myEchartsView_Line.ShowWithOption(opString); }); } catch (Exception ex) { MainPage.Log($"sensor history error : {ex.Message}"); } finally { Application.RunOnMainThread(() => { loadPage.Hide(); }); } }) { IsBackground = true }.Start(); } } } HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_BrokenLine.cs
@@ -47,17 +47,25 @@ /// </summary> /// <param name="displayScale">显示比例 0-100,比如设置了30,只显示30%,可以左右拖动显示其他</param> /// <returns></returns> public string InitOption(int displayScale) public string InitOption(int displayScale, bool isBar = false) { //组装Value var newstring = optionString2.Replace("{0}", XvalueText); newstring = newstring.Replace("{1}", YvalueText); newstring = newstring.Replace("{10}", xTitle); if (isBar) { newstring = newstring.Replace("{11}", "true"); } else { newstring = newstring.Replace("{11}", "false"); } newstring = newstring.Replace("{20}", yTitle); newstring = newstring.Replace("{30}", displayScale.ToString()); newstring = newstring.Replace(",,", ","); return newstring; } /// <summary> /// 组装x轴文本 @@ -114,6 +122,53 @@ /// 组装y轴文本 /// </summary> /// <param name="yData"></param> public string InitYdataText2(string name, List<EnvironmentalSensorHistor> yData, string color, bool isBar) { //组装Value yTitle = name; string valueText = string.Empty; var YvalueTextItem = @"{ data:[{1}], type:'{333}', smooth:0.6, symbol:'none', color:'{2}'} "; if (isBar) { YvalueTextItem = YvalueTextItem.Replace("{333}", "bar"); } else { YvalueTextItem = YvalueTextItem.Replace("{333}", "line"); } YvalueTextItem = YvalueTextItem.Replace("{0}", name); foreach (var data in yData) { valueText += "'" + data.fieldValue + "',"; } YvalueTextItem = YvalueTextItem.Replace("{1}", valueText); YvalueTextItem = YvalueTextItem.Replace("{2}", color); if (YvalueText == "") { YvalueText = YvalueTextItem; } else { YvalueText += "," + YvalueTextItem; } return YvalueTextItem; } /// <summary> /// 组装y轴文本 /// </summary> /// <param name="yData"></param> public string InitYdataTextLinearGradient(string name, List<EnvironmentalSensorHistor> yData, string color) { //组装Value @@ -124,7 +179,6 @@ //string bColor = color.Substring(5, 2); var YvalueTextItem = @"{name:'{0}', data:[{1}], type:'line', smooth:0.6, symbol:'none', color:'{2}CC', @@ -194,7 +248,7 @@ fontSize:30, }, }, series: [ series: [ {1} ] }"; @@ -241,7 +295,7 @@ xAxis: { name: '{10}', type: 'category', boundaryGap: false, boundaryGap: {11}, data: [{0}], axisLabel : { fontSize:30, @@ -277,7 +331,7 @@ }, xAxis: { type: 'category', boundaryGap: false, boundaryGap: {11}, data: [{0}], name: '{10}' },