Changeset 7977
- Timestamp:
- 06/11/12 09:02:04 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.cs
r7304 r7977 104 104 if (Content != null) { 105 105 chart.Titles[0].Text = Content.Name; 106 foreach (DataRow row in Content.Rows) 107 AddDataRow(row); 106 AddDataRows(Content.Rows); 108 107 ConfigureChartArea(chart.ChartAreas[0]); 109 108 RecalculateAxesScale(chart.ChartAreas[0]); … … 123 122 } else MessageBox.Show("Nothing to configure."); 124 123 } 125 126 protected virtual void AddDataRow(DataRow row) { 127 Series series = new Series(row.Name); 128 if (row.VisualProperties.DisplayName.Trim() != String.Empty) series.LegendText = row.VisualProperties.DisplayName; 129 else series.LegendText = row.Name; 130 ConfigureSeries(series, row); 131 FillSeriesWithRowValues(series, row); 132 133 chart.Series.Add(series); 124 protected virtual void AddDataRows(IEnumerable<DataRow> rows) { 125 foreach (var row in rows) { 126 RegisterDataRowEvents(row); 127 Series series = new Series(row.Name); 128 if (row.VisualProperties.DisplayName.Trim() != String.Empty) series.LegendText = row.VisualProperties.DisplayName; 129 else series.LegendText = row.Name; 130 ConfigureSeries(series, row); 131 FillSeriesWithRowValues(series, row); 132 chart.Series.Add(series); 133 } 134 134 ConfigureChartArea(chart.ChartAreas[0]); 135 135 RecalculateAxesScale(chart.ChartAreas[0]); … … 265 265 } 266 266 267 268 protected virtual void RemoveDataRow(DataRow row) { 269 Series series = chart.Series[row.Name]; 270 chart.Series.Remove(series); 271 if (invisibleSeries.Contains(series)) 272 invisibleSeries.Remove(series); 267 protected virtual void RemoveDataRows(IEnumerable<DataRow> rows) { 268 foreach (var row in rows) { 269 DeregisterDataRowEvents(row); 270 Series series = chart.Series[row.Name]; 271 chart.Series.Remove(series); 272 if (invisibleSeries.Contains(series)) 273 invisibleSeries.Remove(series); 274 } 273 275 RecalculateAxesScale(chart.ChartAreas[0]); 274 276 } … … 298 300 Invoke(new CollectionItemsChangedEventHandler<DataRow>(Rows_ItemsAdded), sender, e); 299 301 else { 300 foreach (DataRow row in e.Items) { 301 AddDataRow(row); 302 RegisterDataRowEvents(row); 303 } 302 AddDataRows(e.Items); 304 303 } 305 304 } … … 308 307 Invoke(new CollectionItemsChangedEventHandler<DataRow>(Rows_ItemsRemoved), sender, e); 309 308 else { 310 foreach (DataRow row in e.Items) { 311 DeregisterDataRowEvents(row); 312 RemoveDataRow(row); 313 } 309 RemoveDataRows(e.Items); 314 310 } 315 311 } … … 318 314 Invoke(new CollectionItemsChangedEventHandler<DataRow>(Rows_ItemsReplaced), sender, e); 319 315 else { 320 foreach (DataRow row in e.OldItems) { 321 DeregisterDataRowEvents(row); 322 RemoveDataRow(row); 323 } 324 foreach (DataRow row in e.Items) { 325 AddDataRow(row); 326 RegisterDataRowEvents(row); 327 } 316 RemoveDataRows(e.OldItems); 317 AddDataRows(e.Items); 328 318 } 329 319 } … … 332 322 Invoke(new CollectionItemsChangedEventHandler<DataRow>(Rows_CollectionReset), sender, e); 333 323 else { 334 foreach (DataRow row in e.OldItems) { 335 DeregisterDataRowEvents(row); 336 RemoveDataRow(row); 337 } 338 foreach (DataRow row in e.Items) { 339 AddDataRow(row); 340 RegisterDataRowEvents(row); 341 } 324 RemoveDataRows(e.OldItems); 325 AddDataRows(e.Items); 342 326 } 343 327 }
Note: See TracChangeset
for help on using the changeset viewer.