Exemplo n.º 1
0
        public IndexModel(PoolControl poolControl, IViewLocalizer localizer)
        {
            this.State              = poolControl.GetPoolControlInformation();
            this.GeneralState       = GeneralState.ConvertFromPoolState(poolControl.GetPoolControlInformation());
            this.TemperatureRunTime = this.State.PoolSettings.TemperatureRunTime.ToArray();
            this.PumpingCycles      = this.State.PoolSettings.WorkingMode == PoolWorkingMode.Summer
                ? this.State.PoolSettings.SummerPumpingCycles
                : this.State.PoolSettings.WinterPumpingCycles;

            var chartOptions = new Highcharts
            {
                Title = new Title
                {
                    Text = ""
                },
                XAxis = new List <XAxis>()
                {
                    new XAxis()
                    {
                        Title = new XAxisTitle()
                        {
                            Text = "°C"
                        }
                    }
                },
                YAxis = new List <YAxis>()
                {
                    new YAxis()
                    {
                        Title = new YAxisTitle()
                        {
                            Text = "h"
                        }
                    }
                },
                Series = new List <Series>()
                {
                    new AreaSeries
                    {
                        Name = "h",
                        Data = this.State.PoolSettings.TemperatureRunTime
                               .Select(d => new AreaSeriesData()
                        {
                            X = d.Temperature, Y = d.RunTimeHours
                        })
                               .ToList(),
                    }
                }
            };

            chartOptions.ID    = "chart";
            this.ChartRenderer = new HighchartsRenderer(chartOptions);
        }