/// <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); }
/// <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)); }
/// <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; } } }
/// <summary> /// Returns the index of a specified bar in the stacked bar graph /// </summary> public int IndexOf(Bar value) { return (List.IndexOf(value)); }
/// <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)); }
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; } }