wei
2021-03-26 f369d0b710357c933ed96e73fd337d22906bb0c8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
using System;
using System.Collections.Generic;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
    public class EnergyMainPage : FrameLayout
    {
        FrameLayout bodyView;
        public EnergyMainPage()
        {
            bodyView = this;
        }
 
        public void LoadPage()
        {
            new TopViewDiv(bodyView, Language.StringByID(StringId.EnergyMonitoring)).LoadTopView();
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
 
            var generalTableView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(80),
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealWidth(148),
                Radius = (uint)Application.GetRealWidth(5),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            bodyView.AddChidren(generalTableView);
 
            TextButton btnTotalValue = new TextButton()
            {
                X = Application.GetRealWidth(18),
                Y = Application.GetRealWidth(24),
                Width = Application.GetRealWidth(18),
                Height = Application.GetRealWidth(52),
                TextColor = CSS_Color.FirstLevelTitleColor,
                IsBold = true,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 40,
                Text = "000"
            };
            generalTableView.AddChidren(btnTotalValue);
 
            btnTotalValue.Width = btnTotalValue.GetTextWidth();
 
            var btnTotalValueUint = new Button()
            {
                X = btnTotalValue.Right,
                Y = Application.GetRealWidth(24),
                Width = Application.GetRealWidth(60),
                Height = Application.GetRealWidth(28),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                IsBold = true,
                Text = "kW‧h",
                TextAlignment = TextAlignment.CenterLeft,
            };
            generalTableView.AddChidren(btnTotalValueUint);
 
            var btnValue = new Button()
            {
                X = Application.GetRealWidth(18),
                Y = btnTotalValue.Bottom,
                Width = Application.GetRealWidth(209),
                Height = Application.GetRealWidth(28),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                IsBold = true,
                TextAlignment = TextAlignment.CenterLeft,
            };
            generalTableView.AddChidren(btnValue);
 
            var echartsView = new FrameLayout()
            {
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(100),
                X = Application.GetRealWidth(227),
                Y = Application.GetRealWidth(16),
            };
            generalTableView.AddChidren(echartsView);
            MyEchartsViewOn myEchartsView = new MyEchartsViewOn() {
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealWidth(100),
            };
 
            echartsView.AddChidren(myEchartsView);
            Dictionary<string, string> list = new Dictionary<string, string>();
            list.Add("电冰箱", "12");
            list.Add("电风扇", "2");
            list.Add("空调", "9");
            list.Add("洗衣机", "3");
            list.Add("电脑", "33");
            var echartsPie = new EchartsOption_Pie();
            var echartRootJson = echartsPie.InitDateJson(list);
            //var echartRootJsonString = Newtonsoft.Json.JsonConvert.SerializeObject(echartRootJson);
            myEchartsView.ShowWithOption(echartRootJson);
 
 
        }
    }
}