internal void UpdateValueAxisMinMax() { if (base.items.Count != 0) { double maxValue = double.MaxValue; double minValue = double.MinValue; Dt.Cells.Data.Axis axis = this.Axis; using (IEnumerator <object> enumerator = base.GetEnumerator()) { while (enumerator.MoveNext()) { double?nullable = FormatConverter.TryDouble(enumerator.Current, true); if (nullable.HasValue) { if (nullable.Value < maxValue) { maxValue = nullable.Value; } if (nullable.Value > minValue) { minValue = nullable.Value; } } } } if (axis.AxisType == AxisType.Value) { maxValue = AxisUtility.CalculateValidMinimum(maxValue, minValue, false, axis.LogBase, axis.AutoMin, axis.AutoMax); minValue = AxisUtility.CalculateValidMaximum(maxValue, minValue, false, axis.LogBase); maxValue = AxisUtility.CalculateMinimum(maxValue, minValue, false, axis.LogBase); minValue = AxisUtility.CalculateMaximum(maxValue, minValue, false, axis.LogBase); } if (axis.AutoMin) { if (axis.AxisType == AxisType.Value) { maxValue = AxisUtility.CalculateMinimum(maxValue, minValue, axis.MajorUnit, false, axis.LogBase); } if (maxValue != double.MaxValue) { axis.SetMinInternal(maxValue); } } if (axis.AutoMax) { if (axis.AxisType == AxisType.Value) { minValue = AxisUtility.CalculateMaximum(maxValue, minValue, axis.MajorUnit, false, axis.LogBase, false); } if (minValue != double.MinValue) { axis.SetMaxInternal(minValue); } } if ((axis.AutoMajorUnit || axis.AutoMinorUnit) && ((maxValue != double.MaxValue) && (minValue != double.MinValue))) { axis.UpdateMajorMinorUnit(maxValue, minValue); } } }
void AdjustAxisMinMax(Dt.Cells.Data.Axis axis, object value) { double?nullable = FormatConverter.TryDouble(value, true); if (nullable.HasValue) { if (nullable.Value > axis.Max) { if (axis.AutoMax) { if (axis.AxisType == AxisType.Value) { nullable = new double?(AxisUtility.CalculateMaximum(axis.Min, nullable.Value, axis.MajorUnit, false, axis.LogBase, false)); } double?nullable2 = nullable; if ((((double)nullable2.GetValueOrDefault()) != double.MinValue) || !nullable2.HasValue) { axis.SetMaxInternal(nullable.Value); } if ((axis.AutoMajorUnit || axis.AutoMinorUnit) && ((nullable.Value != double.MaxValue) && (nullable.Value != double.MinValue))) { axis.UpdateMajorMinorUnit(axis.Min, nullable.Value); } } } else if ((nullable.Value < axis.Min) && axis.AutoMin) { if (axis.AxisType == AxisType.Value) { nullable = new double?(AxisUtility.CalculateMinimum(nullable.Value, axis.Max, axis.MajorUnit, false, axis.LogBase)); } if (nullable.Value != double.MaxValue) { axis.SetMinInternal(nullable.Value); } if ((axis.AutoMajorUnit || axis.AutoMinorUnit) && ((nullable.Value != double.MaxValue) && (nullable.Value != double.MinValue))) { axis.UpdateMajorMinorUnit(nullable.Value, axis.Max); } } } }