Exemplo n.º 1
0
		/// <summary>
		/// Inserts a channel in the index specified in the plotter
		/// </summary>
		public void Insert(int index, Channel value)
		{
			if (value == null || index >= List.Count)
			{
				return;
			}

			List.Insert(index, value);
		}
Exemplo n.º 2
0
		/// <summary>
		/// Adds a new Channel into the plotter
		/// </summary>
		public int Add(Channel value)
		{
			if (value == null)
			{
				throw new ArgumentNullException();
			}

			return (List.Add(value));
		}
Exemplo n.º 3
0
		/// <summary>
		/// Removes the specified channel from the plotter
		/// </summary>
		public void Remove(Channel value)
		{
			if (value == null)
			{
				return;
			}

			if (! List.Contains(value))
			{
				throw new ArgumentException();
			}

			for (int i = 0;i < List.Count;i ++)
			{
				if (((Channel) List[i]).YAxisName == value.YAxisName)
				{
					List.RemoveAt(i);
					break;
				}
			}
		}
Exemplo n.º 4
0
		public Cursor(Channel channel)
		{
			this.channel = channel;
		}
Exemplo n.º 5
0
		/// <summary>
		/// Gets the value corresponding to a particular channel from a pixel. Used when
		/// the mouse coordinates need to be tapped to values on the graph
		/// </summary>
		/// <param name="channel"></param>
		/// <param name="XInPixel"></param>
		/// <param name="YInPixel"></param>
		/// <returns></returns>
		private PointF GetValueFromPixel(Channel channel, int XInPixel, int YInPixel)
		{
			float yAbsolute = (GraphArea.Bottom - YInPixel) / (float) GraphArea.Height;
			float yRange = channel.MaximumValue - channel.MinimumValue;

			float yInValue = channel.MinimumValue + (yAbsolute * yRange);
			int xRangeInMs = (int) (xRange.Duration().Ticks / TimeSpan.TicksPerMillisecond);
			float xOffsetPixel = (XInPixel - GraphArea.Left) / (float) GraphArea.Width;
			float xInValue = xOffsetPixel * xRangeInMs;

			return new PointF(xInValue, yInValue);
		}
Exemplo n.º 6
0
		/// <summary>
		/// Converts a value of the channel to the pixels corresponding to the graphArea
		/// so that the value could be easily plotted.
		/// </summary>
		/// <param name="channel"></param>
		/// <param name="XinValue"></param>
		/// <param name="YinValue"></param>
		/// <returns></returns>
		private Point GetPixelFromValue(Channel channel, int XinValue, float YinValue)
		{
			float yRange = channel.MaximumValue - channel.MinimumValue;

			float y = (YinValue - channel.MinimumValue) / yRange;

			int yInPixel = GraphArea.Bottom - (int) (y * GraphArea.Height);

			int xOffsetValue = XinValue;
			xOffsetValue -= leftDisplayLimit;
			int xRangeInMs = (int) (xRange.Duration().Ticks / TimeSpan.TicksPerMillisecond);
			float xOffsetAbs = xOffsetValue / (float) xRangeInMs;
			int xInPixel = GraphArea.Left + (int) (xOffsetAbs * GraphArea.Width);

			return new Point(xInPixel, yInPixel);
		}
Exemplo n.º 7
0
		/// <summary>
		/// Returns the index of a specified channel in the plotter
		/// </summary>
		public int IndexOf(Channel value)
		{
			return (List.IndexOf(value));
		}
Exemplo n.º 8
0
		/// <summary>
		/// Checks whether a channel is contained in the plotter
		/// </summary>
		/// <param name="value">Channel to check for</param>
		/// <returns>True if it is in the stacked bar graph. False otherwise</returns>
		public bool Contains(Channel value)
		{
			// If value is not of type Channel, this will return false.
			return (List.Contains(value));
		}