Пример #1
0
        private void Runner()
        {
            if (TrendMode == iTrendMode.Historical)
            {
                foreach (Series item in chart1.Series)
                {
                    iPen pen    = item.Tag as iPen;
                    iPen curPen = _pens[_bs.Position];
                    if (curPen.Name.Equals(pen.Name))
                    {
                        chart1.ChartAreas[0].AxisX.Minimum = item.Points[0].XValue;
                        chart1.ChartAreas[0].AxisX.Maximum = DateTime.FromOADate(item.Points[item.Points.Count - 1].XValue).AddSeconds(20).ToOADate();
                    }


                    if (pen.Historical != null)
                    {
                        DataTableReader reader = pen.Historical.CreateDataReader();
                        item.Points.DataBindXY(reader, "TmStamp", reader, "Value");
                    }
                }

                chart1.Invalidate();
            }
            else             // Real Time Mode
            {
                DateTime timeStamp = DateTime.Now;
                foreach (Series ptSeries in chart1.Series)
                {
                    AddNewPoint(timeStamp, ptSeries);
                }
            }

            dgvPen.Refresh();
        }
Пример #2
0
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
        {
            if (destType == typeof(string) && value is iPen)
            {
                // Cast the value to an Employee type
                iPen emp = (iPen)value;

                // Return department and department role separated by comma.
                return(emp.ToString());
            }
            return(base.ConvertTo(context, culture, value, destType));
        }
Пример #3
0
        private void AddNewPoint(DateTime timeStamp, System.Windows.Forms.DataVisualization.Charting.Series ptSeries)
        {
            // Extrai o objeto pen previamente colocado na propriedade Tag
            iPen pen = ptSeries.Tag as iPen;

            // Add new data point to its series.
            ptSeries.Points.AddXY(timeStamp.ToOADate(), Double.Parse(pen.Value));

            chart1.ChartAreas[0].AxisX.Minimum = timeStamp.AddSeconds(-30).ToOADate();
            chart1.ChartAreas[0].AxisX.Maximum = timeStamp.AddSeconds(30).ToOADate();

            double zoomMin = DateTime.FromOADate(chart1.ChartAreas[0].AxisX.Minimum).AddSeconds(-10).ToOADate();
            double zoomMax = timeStamp.AddSeconds(5).ToOADate();

            chart1.ChartAreas[0].AxisX.ScaleView.Zoom(zoomMin, zoomMax);

            chart1.Invalidate();
        }
Пример #4
0
 /// <summary>
 /// Removes an employee object from the collection
 /// </summary>
 /// <param name="emp"></param>
 public void Remove(iPen emp)
 {
     base.List.Remove(emp);
 }
Пример #5
0
 /// <summary>
 /// Adds an employee object to the collection
 /// </summary>
 /// <param name="emp"></param>
 public void Add(iPen emp)
 {
     base.List.Add(emp);
 }
Пример #6
0
		/// <summary>
		/// Removes an employee object from the collection
		/// </summary>
		/// <param name="emp"></param>
		public void Remove(iPen emp)
		{
			base.List.Remove(emp);
		}
Пример #7
0
		/// <summary>
		/// Adds an employee object to the collection
		/// </summary>
		/// <param name="emp"></param>
		public void Add(iPen emp)
		{
			base.List.Add(emp);
		}