bool iupPlot::CalculateAxisRange() { if (mAxisX.mAutoScaleMin || mAxisX.mAutoScaleMax) { double theXMin; double theXMax; CalculateXRange(theXMin, theXMax); if (mAxisX.mAutoScaleMin) { mAxisX.mMin = theXMin; if (mAxisX.mLogScale && (theXMin < kLogMinClipValue)) mAxisX.mMin = kLogMinClipValue; } if (mAxisX.mAutoScaleMax) mAxisX.mMax = theXMax; if (!mAxisX.mTickIter->AdjustRange(mAxisX.mMin, mAxisX.mMax)) return false; } if (mAxisY.mAutoScaleMin || mAxisY.mAutoScaleMax) { double theYMin; double theYMax; CalculateYRange(theYMin, theYMax); if (mAxisY.mAutoScaleMin) { mAxisY.mMin = theYMin; if (mAxisY.mLogScale && (theYMin < kLogMinClipValue)) mAxisY.mMin = kLogMinClipValue; } if (mAxisY.mAutoScaleMax) mAxisY.mMax = theYMax; if (!mAxisY.mTickIter->AdjustRange(mAxisY.mMin, mAxisY.mMax)) return false; } if (mScaleEqual) { if (mAxisY.HasZoom() || mAxisX.HasZoom()) { if (mAxisY.mMax - mAxisY.mMin != mAxisX.mMax - mAxisX.mMin) { double theLength; if (mAxisY.mMax - mAxisY.mMin > mAxisX.mMax - mAxisX.mMin) { theLength = mAxisY.mMax - mAxisY.mMin; mAxisX.mMax = mAxisX.mMin + theLength; } else { theLength = mAxisX.mMax - mAxisX.mMin; mAxisY.mMax = mAxisY.mMin + theLength; } } } else { double theMin = mAxisY.mMin; if (mAxisX.mMin < theMin) theMin = mAxisX.mMin; double theMax = mAxisY.mMax; if (mAxisX.mMax > theMax) theMax = mAxisX.mMax; mAxisX.mMin = theMin; mAxisY.mMin = theMin; mAxisX.mMax = theMax; mAxisY.mMax = theMax; } } return true; }
bool iupPlot::CalculateAxisRange() { if (mAxisX.mAutoScaleMin || mAxisX.mAutoScaleMax) { double theXMin; double theXMax; CalculateXRange(theXMin, theXMax); if (mAxisX.mAutoScaleMin) { mAxisX.mMin = theXMin; if (mAxisX.mLogScale && (theXMin < kLogMinClipValue)) mAxisX.mMin = kLogMinClipValue; } if (mAxisX.mAutoScaleMax) mAxisX.mMax = theXMax; if (!mAxisX.mTickIter->AdjustRange(mAxisX.mMin, mAxisX.mMax)) return false; } if (mAxisY.mAutoScaleMin || mAxisY.mAutoScaleMax) { double theYMin; double theYMax; CalculateYRange(theYMin, theYMax); if (mAxisY.mAutoScaleMin) { mAxisY.mMin = theYMin; if (mAxisY.mLogScale && (theYMin < kLogMinClipValue)) mAxisY.mMin = kLogMinClipValue; } if (mAxisY.mAutoScaleMax) mAxisY.mMax = theYMax; if (!mAxisY.mTickIter->AdjustRange(mAxisY.mMin, mAxisY.mMax)) return false; } if (mAxisX.mAutoScaleEqual && mAxisY.mAutoScaleEqual && mAxisX.mAutoScaleMin && mAxisX.mAutoScaleMax && mAxisY.mAutoScaleMin && mAxisY.mAutoScaleMax) { double theMin = mAxisY.mMin; if (mAxisX.mMin < theMin) theMin = mAxisX.mMin; double theMax = mAxisY.mMax; if (mAxisX.mMax > theMax) theMax = mAxisX.mMax; mAxisX.mMin = theMin; mAxisY.mMin = theMin; mAxisX.mMax = theMax; mAxisY.mMax = theMax; } return true; }