public void copyFrom(PlotCalc pc) { //Copy data points. click1.XValue = pc.click1.XValue; click1.YValues = pc.click1.YValues; click2.XValue = pc.click2.XValue; click2.YValues = pc.click2.YValues; midSlope.XValue = pc.midSlope.XValue; midSlope.YValues = pc.midSlope.YValues; peak.XValue = pc.peak.XValue; peak.YValues = pc.peak.YValues; //Copy pointers to identifiers. parentSeriesString = pc.parentSeriesString; thisSeriesString = pc.thisSeriesString; parentSeriesPointer = pc.parentSeriesPointer; thisSeriesPointer = pc.thisSeriesPointer; chartPointer = pc.chartPointer; }
private void makeUniqueName(PlotCalc pc) { Boolean isUnique = false; int counter = 0; while (!isUnique) { isUnique = true; //Search series to make sure name is unique. for (int i = 0; i < pc.chartPointer.Series.Count(); i++) { if (pc.chartPointer.Series[i].Name == pc.parentSeriesString + ", Calc" + counter) { //Increment counter and try again if duplicate found. counter++; isUnique = false; } } } //Unique name found. Set it in the calculation class. pc.thisSeriesString = pc.parentSeriesString + ", Calc" + counter; }
//Copy constructor. public PlotCalc(PlotCalc pc) { copyFrom(pc); }