protected static string FormatForType(object o, HistogramValueTypes valueType) { if (o == null) { return(string.Empty); } switch (valueType) { case HistogramValueTypes.Currency: return(String.Format(CultureInfo.CurrentCulture, "{0:C}", o)); case HistogramValueTypes.Decimal: case HistogramValueTypes.Time: return(String.Format(CultureInfo.CurrentCulture, "{0:#,##0.0#}", o)); case HistogramValueTypes.Integer: return(String.Format(CultureInfo.CurrentCulture, "{0:#,##0}", o)); default: return(o.ToString()); } }
public static string FormatForType(object o, HistogramValueTypes valueType, bool fUseHHMM = false, bool fIncludeZero = true) { if (o == null) { return(string.Empty); } switch (valueType) { case HistogramValueTypes.Currency: return(String.Format(CultureInfo.CurrentCulture, "{0:C}", o)); case HistogramValueTypes.Decimal: case HistogramValueTypes.Time: return(o.FormatDecimal(fUseHHMM, fIncludeZero)); case HistogramValueTypes.Integer: return(String.Format(CultureInfo.CurrentCulture, "{0:#,##0}", o)); default: return(o.ToString()); } }
public HistogramableValue(string fieldName, string displayName, HistogramValueTypes dataType) { DataField = fieldName; DataName = displayName; DataType = dataType; }