//Constructor generates the values for all the values in the class, including the equation public StraightFit(ObservableCollection <CoordPoint> coordinates, ChartBounds CurrentBounds, Canvas currentCanvas) { this.currentCanvas = currentCanvas; this.maxBoundsX = CurrentBounds.MaxBoundsX; this.minBoundsX = CurrentBounds.MinBoundsX; this.maxBoundsY = CurrentBounds.MaxBoundsY; this.minBoundsY = CurrentBounds.MinBoundsY; this.coordinates = coordinates; for (int i = 0; i < coordinates.Count; i++) { XValues.Add(coordinates[i].X); } for (int i = 0; i < coordinates.Count; i++) { YValues.Add(coordinates[i].Y); } xBar = Mean(XValues); yBar = Mean(YValues); Sxy = Variance(XValues, YValues); Sxx = Variance(XValues, XValues); Gradient = Sxy / Sxx; YIntercept = yBar - (Gradient * xBar); }
public Plot(Canvas currentCanvas, ChartBounds currentBounds, double X, double Y) { this.X = X; this.Y = Y; this.currentCanvas = currentCanvas; this.maxBoundsX = currentBounds.MaxBoundsX; this.minBoundsX = currentBounds.MinBoundsX; this.maxBoundsY = currentBounds.MaxBoundsY; this.minBoundsY = currentBounds.MinBoundsY; }
public Grid(ChartBounds currentBounds, Canvas currentCanvas, Canvas currentBorderCanvas, GridIntervals currentIntervals) { this.currentCanvas = currentCanvas; this.currentBorderCanvas = currentBorderCanvas; this.maxBoundsX = currentBounds.MaxBoundsX; this.minBoundsX = currentBounds.MinBoundsX; this.maxBoundsY = currentBounds.MaxBoundsY; this.minBoundsY = currentBounds.MinBoundsY; this.MajorIntervalsX = currentIntervals.MajorIntervalsX; this.MajorIntervalsY = currentIntervals.MajorIntervalsY; this.MinorIntervalsX = currentIntervals.MinorIntervalsX; this.MinorIntervalsY = currentIntervals.MinorIntervalsY; }
public ExponentialIncreaseFit(ObservableCollection <CoordPoint> coordinates, Canvas currentCanvas, ChartBounds CurrentBounds, double C) { this.currentCanvas = currentCanvas; this.maxBoundsX = CurrentBounds.MaxBoundsX; this.minBoundsX = CurrentBounds.MinBoundsX; this.maxBoundsY = CurrentBounds.MaxBoundsY; this.minBoundsY = CurrentBounds.MinBoundsY; this.coordinates = coordinates; this.C = C; // Puts the X and Y values into their on list so they can be calculated on for (int i = 0; i < coordinates.Count; i++) { XValues.Add(coordinates[i].X); } for (int i = 0; i < coordinates.Count; i++) { YValues.Add((((coordinates[i].Y / C) - 1) * -1)); } // Sets the curve values A = GetA(); B = GetB(); }
//Indiv Uncertainty public Uncertainty(CoordPoint coordinate, IndivUncValues indivUncValues, Canvas currentCanvas, ChartBounds currentBounds) { this.coordinate = coordinate; this.xUncertaintyPlus = indivUncValues.XPlus; this.xUncertaintyMinus = indivUncValues.XMinus; this.yUncertaintyPlus = indivUncValues.YPlus; this.yUncertaintyMinus = indivUncValues.YMinus; this.currentCanvas = currentCanvas; this.minBoundsX = currentBounds.MinBoundsX; this.minBoundsY = currentBounds.MinBoundsY; this.maxBoundsX = currentBounds.MaxBoundsX; this.maxBoundsY = currentBounds.MaxBoundsY; PlotXLineMinus(); PlotYLineMinus(); PlotYLinePlus(); PlotXLinePlus(); }
//Single Uncertainty public Uncertainty(CoordPoint coordinate, double xUncertainty, double yUncertainty, bool Percentage, Canvas currentCanvas, ChartBounds currentBounds) { this.coordinate = coordinate; this.currentCanvas = currentCanvas; this.minBoundsX = currentBounds.MinBoundsX; this.minBoundsY = currentBounds.MinBoundsY; this.maxBoundsX = currentBounds.MaxBoundsX; this.maxBoundsY = currentBounds.MaxBoundsY; if (Percentage) { this.xUncertaintyPlus = coordinate.X * (xUncertainty / 100); this.xUncertaintyMinus = coordinate.X * (xUncertainty / 100); this.yUncertaintyPlus = coordinate.Y * (yUncertainty / 100); this.yUncertaintyMinus = coordinate.Y * (yUncertainty / 100); } else { this.xUncertaintyPlus = xUncertainty; this.xUncertaintyMinus = xUncertainty; this.yUncertaintyPlus = yUncertainty; this.yUncertaintyMinus = yUncertainty; } PlotXLineMinus(); PlotYLineMinus(); PlotYLinePlus(); PlotXLinePlus(); }