示例#1
0
		/// <summary>
		/// Inserts a bar in the index specified in the stacked bar graph
		/// </summary>
		public void Insert(int index, Bar value)
		{
			if (value == null || index >= List.Count)
			{
				return;
			}

			List.Insert(index, value);
		}
示例#2
0
		/// <summary>
		/// Adds a new bar into the stacked bar graph
		/// </summary>
		public int Add(Bar value)
		{
			if (value == null)
			{
				throw new ArgumentNullException();
			}

			return (List.Add(value));
		}
示例#3
0
		/// <summary>
		/// Removes the specified bar from the stacked bar graph
		/// </summary>
		public void Remove(Bar value)
		{
			if (value == null)
			{
				return;
			}

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

			for (int i = 0;i < List.Count;i ++)
			{
				if (((Bar) List[i]).Name == value.Name)
				{
					List.RemoveAt(i);
					break;
				}
			}
		}
示例#4
0
		/// <summary>
		/// Returns the index of a specified bar in the stacked bar graph
		/// </summary>
		public int IndexOf(Bar value)
		{
			return (List.IndexOf(value));
		}
示例#5
0
		/// <summary>
		/// Checks whether a bar is contained in the stacked bar graph
		/// </summary>
		/// <param name="value">Bar to check for</param>
		/// <returns>True if it is in the stacked bar graph. False otherwise</returns>
		public bool Contains(Bar value)
		{
			// If value is not of type Bar, this will return false.
			return (List.Contains(value));
		}
示例#6
0
		public void AddBar(string label, string xpath)
		{
			if (_doc == null)
			{
				return;
			}

			int i = GetCount(xpath);
			if (i == 0)
			{
				return;
			}
			Bar bar = new Bar(label, i);
			_graph.Bars.Add(bar);
			if (i > _graph.MaximumValue)
			{
				_graph.MaximumValue = i;
			}

			int labelWidth = 15 + TextRenderer.MeasureText(label, _graph.Font).Width;
			if (labelWidth > _graph.GraphMarginLeft)
			{
				_graph.GraphMarginLeft = labelWidth;
			}
		}