Esempio n. 1
0
        private void updateLastThirte(int time)
        {
            int num = time + 1 < (int)xMax ? time + 1 : (int)xMax;

            for (int i = Time; i < num; i++)
            {
                LastThirty.RemoveAt(0);
                LastThirty.Add(ChartValuesCurrentAndAttach[i]);
            }
        }
Esempio n. 2
0
        //updates the series according to the new choosen value
        public void updateSeries(string content, int time)
        {
            if (content == "")
            {
                return;
            }
            Property     property = getData(content);
            List <float> vs       = property.Data;
            List <float> attach   = getData(property.Attach).Data;

            //create an array of the new wanted points.
            ObservablePoint[] points  = new ObservablePoint[vs.Count];
            ObservablePoint[] points2 = new ObservablePoint[vs.Count];
            ObservablePoint[] points3 = new ObservablePoint[vs.Count];
            for (int i = 0; i < vs.Count; i++)
            {
                points[i]  = new ObservablePoint(i, vs[i]);
                points2[i] = new ObservablePoint(i, attach[i]);
                points3[i] = new ObservablePoint(vs[i], attach[i]);
            }
            if (lsReports != null)
            {
                AnalomyPoints.Clear();
                foreach (AnomalyReportSafe reportSafe in lsReports)
                {
                    if (reportSafe.first == content)
                    {
                        AnalomyPoints.Add(points3[reportSafe.time]);
                        mapper.Add(points3[reportSafe.time], time);
                    }
                }
                INotifyPropertyChanged("AnalomyPoints");
            }
            //update the new data
            XMax       = vs.Count;
            XMaxAttach = attach.Max();
            XMinAttach = attach.Min();
            XMaxThird  = vs.Max();
            XMinThird  = vs.Min();
            if (XMaxThird == XMinThird)
            {
                XMaxThird += 1;
                XMinThird -= 1;
            }
            ChartValues.Clear();
            ChartValues.AddRange(points);
            INotifyPropertyChanged("ChartValues");
            ChartValuesAttach.Clear();
            ChartValuesAttach.AddRange(points2);
            INotifyPropertyChanged("ChartValuesAttach");
            ChartValuesCurrentAndAttach.Clear();
            ChartValuesCurrentAndAttach.AddRange(points3);
            INotifyPropertyChanged("ChartValuesCurrentAndAttach");
            try
            {
                LastThirty.Clear();
                for (int i = time - 200 < 0 ? 0 : time - 200; i < (time < xMax ? time : xMax); i++)
                {
                    LastThirty.Add(ChartValuesCurrentAndAttach[i]);
                }
            }
            catch (Exception)
            {
            }
            LineSafe line = getLinearReg(vs, attach);

            LinearRegVal.Clear();
            float x1 = vs.Min(), y1 = line.b + x1 * line.a;
            float x2 = vs.Max(), y2 = line.b + x2 * line.a;

            LinearRegVal.Add(new ObservablePoint(x1, y1));
            LinearRegVal.Add(new ObservablePoint(x2, y2));
        }