Changeset 12826
- Timestamp:
- 08/02/15 10:56:34 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.Analysis.Views/3.3/IndexedDataTableView.cs
r12822 r12826 153 153 /// <param name="row">DataRow to add as series to the chart.</param> 154 154 protected virtual void AddDataRow(IndexedDataRow<T> row) { 155 if (row.Values.Count == 0) return; 156 155 157 Series series = new Series(row.Name); 156 158 if (row.VisualProperties.DisplayName.Trim() != String.Empty) series.LegendText = row.VisualProperties.DisplayName; … … 306 308 /// <param name="row">DataRow which series should be removed.</param> 307 309 protected virtual void RemoveDataRow(IndexedDataRow<T> row) { 310 if (chart.Series.All(x => x.Name != row.Name)) return; 308 311 Series series = chart.Series[row.Name]; 309 312 chart.Series.Remove(series); … … 419 422 UpdateYCursorInterval(); 420 423 } 421 } 424 } else AddDataRow((IndexedDataRow<T>)sender); 422 425 } 423 426 } … … 425 428 if (InvokeRequired) 426 429 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_ItemsRemoved), sender, e); 430 else { 431 IndexedDataRow<T> row = null; 432 valuesRowsTable.TryGetValue((IObservableList<Tuple<T, double>>)sender, out row); 433 if (row != null) { 434 if (row.Values.Count == 0) { 435 RemoveDataRow(row); 436 } else { 437 Series rowSeries = chart.Series[row.Name]; 438 if (!invisibleSeries.Contains(rowSeries)) { 439 rowSeries.Points.Clear(); 440 FillSeriesWithRowValues(rowSeries, row); 441 RecalculateAxesScale(chart.ChartAreas[0]); 442 UpdateYCursorInterval(); 443 } 444 } 445 } 446 } 447 } 448 private void Values_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) { 449 if (InvokeRequired) 450 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_ItemsReplaced), sender, e); 451 else { 452 IndexedDataRow<T> row = null; 453 valuesRowsTable.TryGetValue((IObservableList<Tuple<T, double>>)sender, out row); 454 if (row != null) { 455 if (row.Values.Count == 0) { 456 RemoveDataRow(row); 457 } else { 458 Series rowSeries = chart.Series[row.Name]; 459 if (!invisibleSeries.Contains(rowSeries)) { 460 if (row.VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Histogram) { 461 rowSeries.Points.Clear(); 462 FillSeriesWithRowValues(rowSeries, row); 463 } else { 464 foreach (IndexedItem<Tuple<T, double>> item in e.Items) { 465 rowSeries.Points[item.Index].SetValueXY(item.Value.Item1, item.Value.Item2); 466 } 467 } 468 RecalculateAxesScale(chart.ChartAreas[0]); 469 UpdateYCursorInterval(); 470 } 471 } 472 } 473 } 474 } 475 private void Values_ItemsMoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) { 476 if (InvokeRequired) 477 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_ItemsMoved), sender, e); 427 478 else { 428 479 IndexedDataRow<T> row = null; … … 439 490 } 440 491 } 441 private void Values_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) { 442 if (InvokeRequired) 443 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_ItemsReplaced), sender, e); 492 493 private void Values_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) { 494 if (InvokeRequired) 495 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_CollectionReset), sender, e); 444 496 else { 445 497 IndexedDataRow<T> row = null; 446 498 valuesRowsTable.TryGetValue((IObservableList<Tuple<T, double>>)sender, out row); 447 499 if (row != null) { 448 Series rowSeries = chart.Series[row.Name]; 449 if (!invisibleSeries.Contains(rowSeries)) { 450 if (row.VisualProperties.ChartType == DataRowVisualProperties.DataRowChartType.Histogram) { 500 if (row.Values.Count == 0) { 501 RemoveDataRow(row); 502 } else { 503 Series rowSeries = chart.Series[row.Name]; 504 if (!invisibleSeries.Contains(rowSeries)) { 451 505 rowSeries.Points.Clear(); 452 506 FillSeriesWithRowValues(rowSeries, row); 453 } else { 454 foreach (IndexedItem<Tuple<T, double>> item in e.Items) { 455 rowSeries.Points[item.Index].SetValueXY(item.Value.Item1, item.Value.Item2); 456 } 507 RecalculateAxesScale(chart.ChartAreas[0]); 508 UpdateYCursorInterval(); 457 509 } 458 RecalculateAxesScale(chart.ChartAreas[0]);459 UpdateYCursorInterval();460 }461 }462 }463 }464 private void Values_ItemsMoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {465 if (InvokeRequired)466 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_ItemsMoved), sender, e);467 else {468 IndexedDataRow<T> row = null;469 valuesRowsTable.TryGetValue((IObservableList<Tuple<T, double>>)sender, out row);470 if (row != null) {471 Series rowSeries = chart.Series[row.Name];472 if (!invisibleSeries.Contains(rowSeries)) {473 rowSeries.Points.Clear();474 FillSeriesWithRowValues(rowSeries, row);475 RecalculateAxesScale(chart.ChartAreas[0]);476 UpdateYCursorInterval();477 }478 }479 }480 }481 482 private void Values_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<Tuple<T, double>>> e) {483 if (InvokeRequired)484 Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Tuple<T, double>>>(Values_CollectionReset), sender, e);485 else {486 IndexedDataRow<T> row = null;487 valuesRowsTable.TryGetValue((IObservableList<Tuple<T, double>>)sender, out row);488 if (row != null) {489 Series rowSeries = chart.Series[row.Name];490 if (!invisibleSeries.Contains(rowSeries)) {491 rowSeries.Points.Clear();492 FillSeriesWithRowValues(rowSeries, row);493 RecalculateAxesScale(chart.ChartAreas[0]);494 UpdateYCursorInterval();495 510 } 496 511 }
Note: See TracChangeset
for help on using the changeset viewer.