using System; using System.Collections.Generic; using System.Linq; using System.Text; using OpenFlashChartASPNETLibraryV2.GraphElement; using System.Collections; namespace OpenFlashChartASPNETLibraryV2.ChartDataValues { /// /// Base (abstract) class for all charts /// /// public abstract class ChartDataBase //: GraphElementBase { // Fields protected List _values; protected int _maxDecimals = 2; protected float _maxValue = float.MinValue; protected float _minValue = float.MaxValue; // Methods /// /// constuctor /// /// Maximum number of decimal places public ChartDataBase(int maxDecimals) { if (maxDecimals < 0) { throw new ArgumentOutOfRangeException("maxDecimals", "must be >=0"); } this._maxDecimals = maxDecimals; _values = new List(); } /// /// reset all values /// public void Reset() { this._maxDecimals = 2; _values = new List (); } //public override string StringValue() //{ // return "";// this._sb.ToString(); //} // Properties /// /// Maximum value to be displayed /// public float MaxValue { get { if (this._maxValue < this._minValue) { return float.MaxValue; } return this._maxValue; } } /// /// Minimum value to be displayed /// public float MinValue { get { if (this._minValue > this._maxValue) { return float.MinValue; } return this._minValue; } } public abstract IEnumerable GetValues (); public abstract string ValuesAsString { get; } /// /// Used to format numbers for generated output /// /// protected string GetFormatString() { string formatStr = "0"; if (_maxDecimals > 0) { formatStr = formatStr + "." + new string('#',_maxDecimals); } return formatStr; } } }