Changeset 1987 for trunk/sources
- Timestamp:
- 06/01/09 11:56:45 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization.Test/3.2/LineChartTests.cs
r1984 r1987 219 219 220 220 [Test] 221 public void TestDataRowWithoutValuesShouldntCauseZoomLevelTooHighError() { 222 LineChartTestForm f = new LineChartTestForm(model); 223 224 IDataRow row1 = new DataRow(); 225 226 model.AddDataRow(row1); 227 228 f.ShowDialog(); 229 } 230 231 [Test] 232 public void TestModelWithoutDataRowsShouldntCauseZoomLevelTooHighError() { 233 LineChartTestForm f = new LineChartTestForm(model); 234 235 f.ShowDialog(); 236 } 237 238 [Test] 221 239 public void TestAddValueToDataRow() { 222 240 LineChartTestForm f = new LineChartTestForm(model); … … 340 358 341 359 f.ShowDialog(); 360 } 361 362 [Test] 363 public void TestPersistence() { 364 LineChartTestForm f = new LineChartTestForm(model); 365 366 IDataRow row1 = new DataRow(); 367 row1.AddValues(new double[] {0, 10, 5}); 368 369 IDataRow row2 = new DataRow(); 370 row2.AddValues(new double[] {1, 20, 7}); 371 372 model.AddDataRows(row1, row2); 342 373 } 343 374 -
trunk/sources/HeuristicLab.Visualization/3.2/LineChart.cs
r1980 r1987 398 398 399 399 public void ZoomToFullView() { 400 SetClipX(-0.1, model.MaxDataRowValues - 0.9); 400 double xmin, xmax; 401 GetClippingRange(0, model.MaxDataRowValues-1, out xmin, out xmax); 402 SetClipX(xmin, xmax); 401 403 402 404 foreach (RowEntry rowEntry in rowEntries) { 403 405 YAxisDescriptor yAxis = rowEntry.DataRow.YAxis; 404 406 405 double padding = (yAxis.MaxValue - yAxis.MinValue)*0.05; 406 407 double ymin = yAxis.MinValue - padding; 408 double ymax = yAxis.MaxValue + padding; 409 410 if (Math.Abs(ymin-ymax) < double.Epsilon*5) { 411 ymin -= 0.1; 412 ymax += 0.1; 413 } 414 407 double ymin, ymax; 408 GetClippingRange(yAxis.MinValue, yAxis.MaxValue, out ymin, out ymax); 415 409 SetClipY(rowEntry, ymin, ymax); 416 410 } 417 411 418 412 canvasUI.Invalidate(); 413 } 414 415 /// <summary> 416 /// Calculates the required clipping range such that the specified min/max values 417 /// visible including a small padding. 418 /// </summary> 419 /// <param name="minValue"></param> 420 /// <param name="maxValue"></param> 421 /// <param name="clipFrom"></param> 422 /// <param name="clipTo"></param> 423 private static void GetClippingRange(double minValue, double maxValue, out double clipFrom, out double clipTo) { 424 if (minValue == double.MaxValue || maxValue == double.MinValue) { 425 clipFrom = -0.1; 426 clipTo = 1.1; 427 } else { 428 double padding = (maxValue - minValue)*0.05; 429 clipFrom = minValue - padding; 430 clipTo = maxValue + padding; 431 432 if (Math.Abs(clipTo - clipFrom) < double.Epsilon * 5) { 433 clipFrom -= 0.1; 434 clipTo += 0.1; 435 } 436 } 419 437 } 420 438
Note: See TracChangeset
for help on using the changeset viewer.