-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindowCsBackup.txt
797 lines (550 loc) · 23.4 KB
/
MainWindowCsBackup.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.IO;
using DataFlow.GridDialog;
using DataFlow.LineDialog;
namespace DataFlow
{
// Interaction logic for MainWindow.xaml
public partial class MainWindow : Window
{
#region Chart Declarations
private Line[] gridLinesVert = new Line[1000];
private Line[] gridLinesHoriz = new Line[1000];
private Label[] gridLabelVert = new Label[1000];
private Label[] gridLabelHoriz = new Label[1000];
public double totalLinesX = 10;
public double totalLinesY = 10;
public double maxBoundsX = 100;
public double minBoundsX = 0;
public double maxBoundsY = 100;
public double minBoundsY = 0;
public int minorLinesX = 5;
public int minorLinesY = 5;
private double MultiplierX;
private double MultiplierY;
private ObservableCollection<CustomPoint> coordinates = new ObservableCollection<CustomPoint>();
private Regression CurrentLine;
private bool MinorLines;
private ExponentialFit MyFit;
private bool HalfLivesOn;
#endregion
// MainWindow Constructor
public MainWindow()
{
InitializeComponent();
// Sets the binding for the datagrid
this.DataContext = coordinates;
// Initialises the multipliers for drawing the chart/annotations
MultiplierX = ((int)ChartCanvas.Width / (int)maxBoundsX);
MultiplierY = ((int)ChartCanvas.Height / (int)maxBoundsY);
CurrentLine = Regression.None;
MinorLines = true;
HalfLivesOn = false;
}
#region Chart Re/Drawing of canvas
// Creates the grid lines
private void ChartCanvas_CreateChartGrid()
{
double lineX = 0;
double LabelintervalY = ((double)maxBoundsY - minBoundsY) / totalLinesY;
double LabelintervalX = ((double)maxBoundsX - minBoundsX) / totalLinesX;
int LineCounter = 0;
// Create a Black Brush
SolidColorBrush blackBrush = new SolidColorBrush();
blackBrush.Color = Colors.Black;
SolidColorBrush grayBrush = new SolidColorBrush();
grayBrush.Color = Colors.Gray;
SolidColorBrush lightGrayBrush = new SolidColorBrush();
lightGrayBrush.Color = Colors.Black;
int OriginLineVert = 0;
bool OriginLineVertThere = false;
// Creating Vertical Grid lines
for (int i = 0; lineX <= (ChartCanvas.Width); ++i)
{
gridLinesVert[i] = new Line();
gridLinesVert[i].X1 = lineX;
gridLinesVert[i].Y1 = 0;
gridLinesVert[i].X2 = lineX;
gridLinesVert[i].Y2 = ChartCanvas.Height;
// Set Line's width, color
gridLinesVert[i].Stroke = blackBrush;
bool OriginLine = false;
if (minBoundsX + (LabelintervalX * ((double)i / minorLinesX)) == 0.0)
{
gridLinesVert[i].StrokeThickness = 2;
gridLinesVert[i].Stroke = blackBrush;
OriginLineVert = i;
OriginLineVertThere = true;
OriginLine = true;
}
if ((LineCounter % minorLinesX == 0) && OriginLine == false)
{
gridLinesVert[i].Stroke = lightGrayBrush;
ChartCanvas.Children.Add(gridLinesVert[i]);
}
else if(OriginLine == false)
{
gridLinesVert[i].StrokeThickness = 1;
gridLinesVert[i].Stroke = grayBrush;
ChartCanvas.Children.Add(gridLinesVert[i]);
}
// Add line to the Grid.
lineX += ((ChartCanvas.Width) / totalLinesX) / minorLinesX;
LineCounter++;
}
double lineY = 0;
LineCounter = 0;
int OriginLineHoriz = 0;
bool OriginLineHorizThere = false;
// Creating Horizontal Grid lines
for (int i = 0; lineY <= ChartCanvas.Height; ++i)
{
gridLinesHoriz[i] = new Line();
gridLinesHoriz[i].X1 = 0;
gridLinesHoriz[i].Y1 = lineY;
gridLinesHoriz[i].X2 = ChartCanvas.Width;
gridLinesHoriz[i].Y2 = lineY;
// Set Line's width, color
gridLinesHoriz[i].Stroke = blackBrush;
bool OriginLine = false;
if (minBoundsY + (LabelintervalY * ((double)i / minorLinesY)) == 0)
{
gridLinesHoriz[i].StrokeThickness = 2;
gridLinesHoriz[i].Stroke = blackBrush;
OriginLineHoriz = i;
OriginLineHorizThere = true;
OriginLine = true;
}
if ((LineCounter % minorLinesY == 0) && OriginLine == false)
{
gridLinesHoriz[i].Stroke = lightGrayBrush;
ChartCanvas.Children.Add(gridLinesHoriz[i]);
}
else if (OriginLine == false)
{
gridLinesHoriz[i].StrokeThickness = 1;
gridLinesHoriz[i].Stroke = grayBrush;
ChartCanvas.Children.Add(gridLinesHoriz[i]);
}
// Add line to the Grid.
lineY += ((ChartCanvas.Height) / totalLinesY) / minorLinesY;
LineCounter++;
}
if (OriginLineHorizThere)
{
ChartCanvas.Children.Add(gridLinesHoriz[OriginLineHoriz]);
}
if (OriginLineVertThere)
{
ChartCanvas.Children.Add(gridLinesVert[OriginLineVert]);
}
// Add Border lines
Rectangle BorderRectangle = new Rectangle()
{
Height = ChartCanvas.Height,
Width = ChartCanvas.Width,
Stroke = blackBrush,
StrokeThickness = 1
};
// Add lines to the Grid
ChartCanvas.Children.Add(BorderRectangle);
double interval = (ChartCanvas.Width) / totalLinesX;
double Currentinterval = -10;
ScaleTransform flipTrans = new ScaleTransform();
flipTrans.ScaleY = -1;
// Create Vertical Labels
for (int i = 0; Currentinterval < (ChartCanvas.Width); i++)
{
gridLabelVert[i] = new Label();
gridLabelVert[i].FontSize = 16;
gridLabelVert[i].Content = minBoundsX + (LabelintervalX * i);
gridLabelVert[i].RenderTransformOrigin = new Point(0.5, 0.5);
gridLabelVert[i].Margin = new Thickness(Currentinterval, -35, 0, 0);
gridLabelVert[i].RenderTransform = flipTrans;
BorderCanvas.Children.Add(gridLabelVert[i]);
Currentinterval += interval;
}
interval = (ChartCanvas.Height) / totalLinesY;
Currentinterval = -15;
// Create Horizontal Labels
for (int i = 0; Currentinterval < (ChartCanvas.Height); i++)
{
gridLabelHoriz[i] = new Label();
gridLabelHoriz[i].FontSize = 16;
gridLabelHoriz[i].Content = minBoundsY + (LabelintervalY) * i;
gridLabelHoriz[i].RenderTransformOrigin = new Point(0.5, 0.5);
gridLabelHoriz[i].Margin = new Thickness(-40, Currentinterval, 0, 0);
gridLabelHoriz[i].RenderTransform = flipTrans;
BorderCanvas.Children.Add(gridLabelHoriz[i]);
Currentinterval += interval;
}
}
// Called when the canvas is resized
private void ChartCanvas_RedrawChart()
{
// Resize the chart with respect to the window size, so all the numbers are also displayed
ChartCanvas.Height = (ChartWindow.Height - 150);
ChartCanvas.Width = (ChartWindow.Width - 250);
BorderCanvas.Height = (ChartWindow.Height - 150);
BorderCanvas.Width = (ChartWindow.Width - 250);
MultiplierX = (ChartCanvas.Width / (maxBoundsX - minBoundsX));
MultiplierY = (ChartCanvas.Height / (maxBoundsY - minBoundsY));
// Clear + redraw canvas
for (int i = 0; i < 12; i++)
{
BorderCanvas.Children.Remove(gridLabelHoriz[i]);
}
for (int i = 0; i < 12; i++)
{
BorderCanvas.Children.Remove(gridLabelVert[i]);
}
ChartCanvas.Children.Clear();
ChartCanvas_CreateChartGrid();
if (CurrentLine == Regression.Straight)
{
DrawRegressionLine();
}
if (CurrentLine == Regression.Exp)
{
DrawExpCurve();
}
// Draw any points in the datagrid
for (int i = 0; i < coordinates.Count; i++)
{
PlotOnChart(coordinates[i].ToPoint());
}
//IMPLEMENT UNC
//
//
/*for (int i = 0; i < coordinates.Count; i++)
{
Uncertainties.Uncertainty Unc = new Uncertainties.Uncertainty(coordinates[i].ToPoint(), 10, 10, ChartCanvas, MultiplierX, MultiplierY, minBoundsX, minBoundsY);
}
*/
}
#endregion
#region Annotations/Drawing on canvas
// Plots 2 lines on the charts as a cross at point in parameters
private void PlotOnChart(Point plotPoint)
{
Line PlotLine1 = new Line();
Line PlotLine2 = new Line();
PlotLine1.Stroke = new SolidColorBrush(Colors.Black);
PlotLine2.Stroke = new SolidColorBrush(Colors.Black);
double MultiplierX = (ChartCanvas.Width / (maxBoundsX - minBoundsX));
double MultiplierY = (ChartCanvas.Height / (maxBoundsY - minBoundsY));
double XCordOnChart = ((plotPoint.X - (minBoundsX)) * MultiplierX);
double YCordOnChart = ((plotPoint.Y - (minBoundsY)) * MultiplierY);
PlotLine1.X1 = XCordOnChart + 5;
PlotLine1.Y1 = YCordOnChart + 5;
PlotLine1.X2 = XCordOnChart - 5;
PlotLine1.Y2 = YCordOnChart - 5;
PlotLine2.X1 = XCordOnChart - 5;
PlotLine2.Y1 = YCordOnChart + 5;
PlotLine2.X2 = XCordOnChart + 5;
PlotLine2.Y2 = YCordOnChart - 5;
ChartCanvas.Children.Add(PlotLine1);
ChartCanvas.Children.Add(PlotLine2);
}
// When the user finishes editing a cell, this redraws the canvas grid and then draws the points in the datagrid
private void XYDataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
ChartCanvas_RedrawChart();
}
// Draws a line of best fit (first order polynomial) on the chart for the data in coordinates
private void DrawRegressionLine()
{
CurrentLine = Regression.Straight;
List<Double> CoordsX = new List<Double>();
List<Double> CoordsY = new List<Double>();
for (int i = 0; i < coordinates.Count; i++)
{
CoordsX.Add(coordinates[i].X);
}
for (int i = 0; i < coordinates.Count; i++)
{
CoordsY.Add(coordinates[i].Y);
}
StraightFit RegressionLineValues = new StraightFit(CoordsX, CoordsY);
GradientLabel.Content = Math.Round(RegressionLineValues.gradient, 2);
YInterceptLabel.Content = Math.Round(RegressionLineValues.yIntercept, 2);
XInterceptLabel.Content = Math.Round(RegressionLineValues.GetXValue(0), 2);
Line RegressionLine = new Line()
{
X1 = ((coordinates[0].X - minBoundsX) * MultiplierX),
Y1 = ((RegressionLineValues.GetYValue(coordinates[0].X) - minBoundsY) * MultiplierY),
X2 = ((coordinates[coordinates.Count - 1].X - minBoundsX) * MultiplierX),
Y2 = ((RegressionLineValues.GetYValue(coordinates[coordinates.Count - 1].X) - minBoundsY) * MultiplierY),
Stroke = new SolidColorBrush(Colors.Red),
StrokeThickness = 2
};
ChartCanvas.Children.Add(RegressionLine);
}
private void DrawExpCurve()
{
CurrentLine = Regression.Exp;
List<Double> CoordsX = new List<Double>();
List<Double> CoordsY = new List<Double>();
for (int i = 0; i < coordinates.Count; i++)
{
CoordsX.Add(coordinates[i].X);
}
for (int i = 0; i < coordinates.Count; i++)
{
CoordsY.Add(coordinates[i].Y);
}
ExponentialFit ExpFit = new ExponentialFit(CoordsX, CoordsY);
double xinc = (double)((maxBoundsX - minBoundsX) / 200f);
for (double i = minBoundsX; i < 2000; i += xinc)
{
double MultiplierX = (ChartCanvas.Width / (maxBoundsX - minBoundsX));
double MultiplierY = (ChartCanvas.Height / (maxBoundsY - minBoundsY));
Line CurveLine = new Line();
SolidColorBrush newBrush = new SolidColorBrush();
newBrush.Color = Colors.Red;
double x1 = (i);
double x2 = (i + xinc);
double y1 = ExpFit.A * Math.Exp(ExpFit.B * x1);
double y2 = ExpFit.A * Math.Exp(ExpFit.B * x2);
CurveLine.X1 = ((x1 - minBoundsX) * MultiplierX);
CurveLine.Y1 = ((y1 - minBoundsY) * MultiplierY);
CurveLine.X2 = ((x2 - minBoundsX) * MultiplierX);
CurveLine.Y2 = ((y2 - minBoundsY) * MultiplierY);
CurveLine.Stroke = newBrush;
CurveLine.StrokeThickness = 2;
ChartCanvas.Children.Add(CurveLine);
}
if (HalfLivesOn)
{
double currentHalfLifeX = 0;
for (int i = 0; i < 7; i++)
{
currentHalfLifeX = ExpFit.HalfLife() * i;
Line HalfLifeLineY = new Line()
{
X1 = (currentHalfLifeX - minBoundsX) * MultiplierX,
Y1 = ExpFit.A * Math.Exp(ExpFit.B * (currentHalfLifeX) - minBoundsY) * MultiplierY,
X2 = (currentHalfLifeX - minBoundsX) * MultiplierX,
Y2 = ExpFit.A * (0 - minBoundsY) * MultiplierY,
Stroke = new SolidColorBrush(Colors.Blue),
StrokeThickness = 1.8,
Opacity = 1,
StrokeDashArray = new DoubleCollection() { 2 }
};
Console.WriteLine(ExpFit.A * (0 - minBoundsY) * MultiplierY);
Console.WriteLine((currentHalfLifeX - minBoundsX) * MultiplierX);
Line HalfLifeLineX = new Line()
{
X1 = (currentHalfLifeX - minBoundsX) * MultiplierX,
Y1 = ExpFit.A * Math.Exp(ExpFit.B * (currentHalfLifeX) - minBoundsY) * MultiplierY,
X2 = 0,
Y2 = ExpFit.A * Math.Exp(ExpFit.B * (currentHalfLifeX) - minBoundsY) * MultiplierY,
Stroke = new SolidColorBrush(Colors.Blue),
StrokeThickness = 1.8,
Opacity = 1,
StrokeDashArray = new DoubleCollection() { 2 }
};
ChartCanvas.Children.Add(HalfLifeLineY);
ChartCanvas.Children.Add(HalfLifeLineX);
}
}
ExpALabel.Content = Math.Round(ExpFit.A, 2);
ExpBLabel.Content = Math.Round(ExpFit.B, 2);
}
#endregion
#region Saving/Opening Files
struct SavefileStruct
{
public ObservableCollection<CustomPoint> SaveCoordinates;
public Regression SaveLine;
public SavefileStruct(ObservableCollection<CustomPoint> CoordsIn, Regression LineIn)
{
this.SaveCoordinates = CoordsIn;
this.SaveLine = LineIn;
}
};
// Saves to a file
private void SaveClick(object sender, RoutedEventArgs e)
{
Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
dlg.FileName = "untitled"; // Default file name
dlg.DefaultExt = ".GraphProject"; // Default file extension
dlg.Filter = "Dataflow Projects (.GraphProject)|*.GraphProject"; // Filter files by extension
// Show save file dialog box
Nullable<bool> result = dlg.ShowDialog();
// Process save file dialog box results
if (result == true)
{
// Save document
string fileName = dlg.FileName;
BinaryWriter binWriter = new BinaryWriter(File.Open(fileName, FileMode.Create));
binWriter.Close();
}
}
private void OpenClick(object sender, RoutedEventArgs e)
{
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.FileName = "untitled"; // Default file name
dlg.DefaultExt = ".GraphProject"; // Default file extension
dlg.Filter = "Dataflow Projects (.GraphProject)|*.GraphProject"; // Filter files by extension
// Show open file dialog box
Nullable<bool> result = dlg.ShowDialog();
// Process open file dialog box results
if (result == true)
{
// Open document
string filename = dlg.FileName;
}
}
private void ImportClick(object sender, RoutedEventArgs e)
{
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.Filter = "Microsoft Excel Files (.xlsx)|*.xlsx"; // Filter files by extension
// Show open file dialog box
Nullable<bool> result = dlg.ShowDialog();
// Process open file dialog box results
if (result == true)
{
// Open document
string filename = dlg.FileName;
ExcelFile ImportExcel = new ExcelFile(filename);
coordinates = ImportExcel.ToObservableCollection();
ImportExcel.Close();
XYDataGrid.ItemsSource = null;
XYDataGrid.ItemsSource = coordinates;
ChartCanvas_RedrawChart();
}
}
#endregion
#region Event/Button Handlers
private void RegressionButton_Click(object sender, RoutedEventArgs e)
{
DrawRegressionLine();
ChartCanvas_RedrawChart();
}
private void ExpRegressionButton_Click(object sender, RoutedEventArgs e)
{
DrawExpCurve();
ChartCanvas_RedrawChart();
}
private void ChartWindow_SizeChanged(object sender, SizeChangedEventArgs e)
{
ChartCanvas_RedrawChart();
}
private void DomainClick(object sender, RoutedEventArgs e)
{
maxBoundsX = Convert.ToDouble(DomainMaxBox.Text);
minBoundsX = Convert.ToDouble(DomainMinBox.Text);
ChartCanvas_RedrawChart();
}
private void RangeClick(object sender, RoutedEventArgs e)
{
maxBoundsY = Convert.ToDouble(RangeMaxBox.Text);
minBoundsY = Convert.ToDouble(RangeMinBox.Text);
ChartCanvas_RedrawChart();
}
private void SwitchToExp(object sender, RoutedEventArgs e)
{
CurrentLine = Regression.Exp;
ChartCanvas_RedrawChart();
}
private void SwitchToStraight(object sender, RoutedEventArgs e)
{
CurrentLine = Regression.Straight;
ChartCanvas_RedrawChart();
}
#endregion
#region Dialogs
private void showGridBox()
{
// Instantiate the dialog box
GridDialog.GridDialogBox dlg = new GridDialog.GridDialogBox();
dlg.LinesOnX = minorLinesX - 1;
dlg.LinesOnY = minorLinesY - 1;
dlg.DomainMax = (int)maxBoundsX;
dlg.DomainMin = (int)minBoundsX;
dlg.RangeMax = (int)maxBoundsY;
dlg.RangeMin = (int)minBoundsY;
// Configure the dialog box
dlg.Owner = this;
// Open the dialog box modally
dlg.ShowDialog();
if (dlg.DialogResult == true)
{
// Update fonts
minorLinesX = (dlg.LinesOnX + 1);
minorLinesY = (dlg.LinesOnY + 1);
maxBoundsX = dlg.DomainMax;
minBoundsX = dlg.DomainMin;
maxBoundsY = dlg.RangeMax;
minBoundsY = dlg.RangeMin;
ChartCanvas_RedrawChart();
}
}
private void Properties_Click_Grid(object sender, RoutedEventArgs e)
{
showGridBox();
}
private void showLineBox()
{
// Instantiate the dialog box
LineDialog.LineDialogBox dlg = new LineDialog.LineDialogBox();
// Configure the dialog box
dlg.Owner = this;
// Open the dialog box modally
dlg.ShowDialog();
}
private void Properties_Click_Line(object sender, RoutedEventArgs e)
{
showLineBox();
}
#endregion
private void AntiAliasButton_Click(object sender, RoutedEventArgs e)
{
if (ChartCanvas.SnapsToDevicePixels)
{
ChartCanvas.SnapsToDevicePixels = false;
}
else
{
ChartCanvas.SnapsToDevicePixels = true;
}
ChartCanvas_RedrawChart();
}
private void HalfLifeCheckBox_Checked(object sender, RoutedEventArgs e)
{
HalfLivesOn = true;
ChartCanvas_RedrawChart();
}
private void HalfLifeCheckBox_Unchecked(object sender, RoutedEventArgs e)
{
HalfLivesOn = false;
ChartCanvas_RedrawChart();
}
}
// This class acts as a reference type for the Point struct.
// It is used in the data grid and then is converted to Point for use in the canvas.
public class CustomPoint
{
public double X { get; set; }
public double Y { get; set; }
// Converts CustomPoint to struct Point
public Point ToPoint()
{
Point TempPoint = new Point();
TempPoint.X = X;
TempPoint.Y = Y;
return TempPoint;
}
}
enum Regression
{
Straight, Exp, Log, Poly, Power, None
};
}