void plotModel_MouseUp(object sender, OxyPlot.OxyMouseEventArgs e) { if (DivergenceConvergencePlot.Series.Any(p => p.GetType() == typeof(OxyPlot.Wpf.LineSeries))) { // int l = DivergenceConvergencePlot.Series.Count; var list = DivergenceConvergencePlot.Series.Where(p => p.GetType() != typeof(OxyPlot.Wpf.LineSeries)).ToList(); DivergenceConvergencePlot.Series.Clear(); list.ForEach(p => DivergenceConvergencePlot.Series.Add(p)); DivergenceConvergencePlot.InvalidatePlot(); } }
// event handler void plotModel_MouseDown(object sender, OxyPlot.OxyMouseDownEventArgs e) { if (DivergenceConvergencePlot.Series.Any(p => p.GetType() == typeof(OxyPlot.Wpf.LineSeries))) { // int l = DivergenceConvergencePlot.Series.Count; var list = DivergenceConvergencePlot.Series.Where(p => p.GetType() != typeof(OxyPlot.Wpf.LineSeries)).ToList(); DivergenceConvergencePlot.Series.Clear(); list.ForEach(p => DivergenceConvergencePlot.Series.Add(p)); DivergenceConvergencePlot.InvalidatePlot(); } try { ScatterPoint res = (ScatterPoint)e.HitTestResult.Item; if (res != null) { string ID = res.Tag.ToString(); OxyPlot.Wpf.LineSeries tempseries = new OxyPlot.Wpf.LineSeries(); List <DataPoint> points = new List <DataPoint>(); //find all series with the ID foreach (OxyPlot.Wpf.ScatterSeries series in DivergenceConvergencePlot.Series) { if (series.Tag.ToString() == ID) { ScatterPoint point = (ScatterPoint)series.Items[0]; points.Add(new DataPoint(point.X, point.Y)); //contains single point } } tempseries.ItemsSource = points; DivergenceConvergencePlot.Series.Add(tempseries); DivergenceConvergencePlot.InvalidatePlot(); } } catch (Exception ex) { } }
private void Reset(object sender, RoutedEventArgs e) { DivergenceConvergencePlot.Series.Clear(); DivergenceConvergencePlot.InvalidatePlot(); //force rerender ValueSeries.ItemsSource = null; ValueSeries.InvalidateVisual(); CountSeries.ItemsSource = null; CountSeries.InvalidateVisual(); SolvedSeriesItems = new List <DataPoint>(); SolvedProductsPlot.Series.Clear(); SolvedProductsPlot.InvalidatePlot(); AverageContrib.Series.Clear(); AverageContrib.InvalidatePlot(); CurrentIteration = 0; RepopAgents(); }