- Timestamp:
- 07/08/15 10:13:45 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Analysis.Views/3.3/ScatterPlotView.cs
r12614 r12670 197 197 private void RecalculateAxesScale(ChartArea area) { 198 198 // Reset the axes bounds so that RecalculateAxesScale() will assign new bounds 199 /*area.AxisX.Minimum = double.NaN; 200 area.AxisX.Maximum = double.NaN; 201 area.AxisY.Minimum = double.NaN; 202 area.AxisY.Maximum = double.NaN;*/ 199 203 area.AxisX.Minimum = CalculateMinBound(xMin); 200 204 area.AxisX.Maximum = CalculateMaxBound(xMax); 205 if (area.AxisX.Minimum == area.AxisX.Maximum) { 206 area.AxisX.Minimum = xMin - 0.5; 207 area.AxisX.Maximum = xMax + 0.5; 208 } 201 209 area.AxisY.Minimum = CalculateMinBound(yMin); 202 210 area.AxisY.Maximum = CalculateMaxBound(yMax); 211 if (area.AxisY.Minimum == area.AxisY.Maximum) { 212 area.AxisY.Minimum = yMin - 0.5; 213 area.AxisY.Maximum = yMax + 0.5; 214 } 215 if (xMax - xMin > 0) area.CursorX.Interval = Math.Pow(10, Math.Floor(Math.Log10(area.AxisX.Maximum - area.AxisX.Minimum) - 3)); 216 else area.CursorX.Interval = 1; 203 217 area.AxisX.IsMarginVisible = false; 204 218 … … 210 224 211 225 private static double CalculateMinBound(double min) { 212 double newMin; 213 if (min < 0) { 214 newMin = -Math.Pow(10, Math.Ceiling(Math.Log10(Math.Abs(min)))); 215 if (newMin / 1.25 < min) newMin /= 1.25; 216 if (newMin / 1.6 < min) newMin /= 1.6; 217 if (newMin / 2.5 < min) newMin /= 2.5; 218 if (newMin / 2.0 < min) newMin /= 2.0; 219 } else { 220 newMin = Math.Pow(10, Math.Floor(Math.Log10(min))); 221 if (newMin * 1.25 < min) newMin *= 1.25; 222 if (newMin * 1.6 < min) newMin *= 1.6; 223 if (newMin * 2.5 < min) newMin *= 2.5; 224 if (newMin * 2.0 < min) newMin *= 2.0; 225 } 226 return newMin; 226 if (min == 0) return 0; 227 var scale = Math.Pow(10, Math.Floor(Math.Log10(Math.Abs(min)))); 228 return scale * (Math.Floor(min / scale)); 227 229 } 228 230 229 231 private static double CalculateMaxBound(double max) { 230 double newMax; 231 if (max < 0) { 232 newMax = -Math.Pow(10, Math.Floor(Math.Log10(Math.Abs(max)))); 233 if (newMax * 1.25 > max) newMax *= 1.25; 234 if (newMax * 1.6 > max) newMax *= 1.6; 235 if (newMax * 2.5 > max) newMax *= 2.5; 236 if (newMax * 2.0 > max) newMax *= 2.0; 237 } else { 238 newMax = Math.Pow(10, Math.Ceiling(Math.Log10(max))); 239 if (newMax / 1.25 > max) newMax /= 1.25; 240 if (newMax / 1.6 > max) newMax /= 1.6; 241 if (newMax / 2.5 > max) newMax /= 2.5; 242 if (newMax / 2.0 > max) newMax /= 2.0; 243 } 244 return newMax; 232 if (max == 0) return 0; 233 var scale = Math.Pow(10, Math.Floor(Math.Log10(Math.Abs(max)))); 234 return scale * (Math.Ceiling(max / scale)); 245 235 } 246 236
Note: See TracChangeset
for help on using the changeset viewer.