/// <summary> /// Removes the given SubAxis from the collection. /// </summary> /// <param name="SubAxis"> /// <see cref="SubAxis"/> object to be removed. /// </param> public void Remove(SubAxis SubAxis) { if (SubAxis != null) { this.List.Remove(SubAxis); } }
/// <summary> /// Removes the SubAxis with the specified name from the collection. /// </summary> /// <param name="name"> /// Name of the SubAxis to be removed. /// </param> public void Remove(string name) { SubAxis axis = FindByName(name); if (axis != null) { this.List.Remove(axis); } }
/// <summary> /// Assigns a unique name to the SubAxis object based on it's type. /// </summary> /// <param name="SubAxis">SubAxis object to be named.</param> internal void AssignUniqueName(SubAxis SubAxis) { // Generate name using SubAxis type name and unique index string name = string.Empty; int index = 1; do { name = "SubAxis" + index.ToString(); ++index; } while(this.FindByName(name) != null && index < 10000); // Asign unique name; SubAxis.Name = name; }
/// <summary> /// Finds SubAxis by name. /// </summary> /// <param name="name">Name of the chart SubAxis.</param> /// <returns>SubAxis or null if it does not exist.</returns> internal SubAxis FindByName(string name) { SubAxis result = null; for (int index = 0; index < this.List.Count; index++) { // Compare SubAxis name if (String.Compare(this[index].Name, name, true, System.Globalization.CultureInfo.CurrentCulture) == 0) { result = this[index]; break; } } return(result); }
/// <summary> /// After new item inserted. /// </summary> /// <param name="index">Item index.</param> /// <param name="value">Item object.</param> /// <remarks> /// This is an internal method and should not be part of the documentation. /// </remarks> protected override void OnInsertComplete(int index, object value) { // Set SubAxis parent axis reference SubAxis subAxis = (SubAxis)value; subAxis.parentAxis = this.parentAxis; if (this.parentAxis != null) { subAxis.chart = this.parentAxis.chart; subAxis.Common = this.parentAxis.Common; subAxis.chartArea = this.parentAxis.chartArea; subAxis.axisType = this.parentAxis.axisType; subAxis.AxisPosition = this.parentAxis.AxisPosition; } this.Invalidate(); }
/// <summary> /// Inserts a SubAxis into the collection. /// </summary> /// <param name="index"> /// Index to insert the object at. /// </param> /// <param name="SubAxis"> /// <see cref="SubAxis"/> object to insert. /// </param> public void Insert(int index, SubAxis SubAxis) { this.List.Insert(index, SubAxis); }
/// <summary> /// Adds a SubAxis to the end of the collection. /// </summary> /// <param name="SubAxis"> /// <see cref="SubAxis"/> object to add. /// </param> /// <returns> /// Index of the newly added object. /// </returns> public int Add(SubAxis SubAxis) { return(this.List.Add(SubAxis)); }