Exemplo n.º 1
0
        public static void FillTSValuesLV(IListView listView, IModel model, int pointId)
        {
            try {
                listView.Clear();
                listView.AddColumn(Localizer.LS(LSID.Timestamp), 140, true, BSDTypes.HorizontalAlignment.Left);
                listView.AddColumn(Localizer.LS(LSID.Value), 120, true, BSDTypes.HorizontalAlignment.Right);

                TSDatabase tsdb    = model.TSDB;
                var        records = tsdb.QueryValues(pointId, DateTime.Now.AddDays(-60), DateTime.Now);
                foreach (TSValue rec in records)
                {
                    var item = listView.AddItem(rec,
                                                ALCore.GetTimeStr(rec.Timestamp),
                                                ALCore.GetDecimalStr(rec.Value)
                                                );
                }
            } catch (Exception ex) {
                fLogger.WriteError("FillTSValuesLV()", ex);
            }
        }
Exemplo n.º 2
0
        public override void UpdateContent()
        {
            fChart.Clear();
            if (fModel == null)
            {
                return;
            }

            TSDatabase tsdb = fModel.TSDB;
            var        pt   = tsdb.GetPoint(fPointId);

            var vals    = new List <ChartPoint>();
            var endTime = DateTime.Now;
            var begTime = endTime.AddHours(-12);

            var records = tsdb.QueryValues(fPointId, begTime, endTime);

            foreach (TSValue rec in records)
            {
                vals.Add(new ChartPoint(rec.Timestamp, rec.Value));
            }

            fChart.ShowData(pt.Name, "Time", "Value", new ChartSeries("Value", ChartStyle.Point, vals, Color.Green));
        }