private void ConstructPlot2() { if (DataSource != null) { var BHPChartValues = new ChartValues <ScatterPoint>(); var dPdGChartValues = new ChartValues <ScatterPoint>(); var GdPdGChartValues = new ChartValues <ScatterPoint>(); var SelectedData = DataSource.Where((x) => x.Time >= EndPumping && x.Time <= EndDecline); foreach (var log in SelectedData) { var InitialTime = SelectedData.ElementAt(0).Time; var DeltaT = (log.Time - InitialTime) / InitialTime; var gDtD = (1 + DeltaT) * (Math.Asin(Math.Pow((1 + DeltaT), -0.5)) + Math.Pow(DeltaT, 0.5)); var xValue = 4 / Math.PI * (gDtD - Math.PI / 2); var BHPPoint = new ScatterPoint(); BHPPoint.X = xValue; BHPPoint.Y = log.SurfacePressure + Phydrostatic; BHPPoint.Weight = 1; BHPChartValues.Add(BHPPoint); } for (int i = 0; i < BHPChartValues.Count - 2; i++) { var tempDPDG = (BHPChartValues.ElementAt(i).Y - BHPChartValues.ElementAt(i + 2).Y) / (BHPChartValues.ElementAt(i + 2).X - BHPChartValues.ElementAt(i).X); var dPdGPoint = new ScatterPoint(); dPdGPoint.X = BHPChartValues.ElementAt(i).X; dPdGPoint.Y = tempDPDG; dPdGPoint.Weight = 1; dPdGChartValues.Add(dPdGPoint); } for (int i = 0; i < dPdGChartValues.Count; i++) { var tempGDPDG = dPdGChartValues.ElementAt(i).Y *dPdGChartValues.ElementAt(i).X; var GdPdGPoint = new ScatterPoint(); GdPdGPoint.X = dPdGChartValues.ElementAt(i).X; GdPdGPoint.Y = tempGDPDG; GdPdGPoint.Weight = 1; GdPdGChartValues.Add(GdPdGPoint); } PlotTwoSeries = new SeriesCollection { new ScatterSeries { Values = BHPChartValues, MinPointShapeDiameter = 5, MaxPointShapeDiameter = 5, Title = "BHP", ScalesYAt = 0, Fill = Brushes.Red }, new ScatterSeries { Values = dPdGChartValues, MinPointShapeDiameter = 5, MaxPointShapeDiameter = 5, Title = "dP/dG", ScalesYAt = 1, Fill = Brushes.Blue }, new ScatterSeries { Values = GdPdGChartValues, MinPointShapeDiameter = 5, MaxPointShapeDiameter = 5, Title = "GdP/dG", ScalesYAt = 1, Fill = Brushes.Green } }; } }