public void FunctionAnnotation() { var s1 = new FunctionAnnotation(); var s2 = new Annotations.FunctionAnnotation(); OxyAssert.PropertiesAreEqual(s2, s1); }
// // Creating the plots. // Use of "Oxyplot" open source plotting library. // public PlotModel FunctionAnnotation(int z, List <List <double> > data_list) { var plotModel1 = new PlotModel(); plotModel1.Title = "Charge States Predictions"; // Each formula is represented with a unique color. // The predictions of each formula for each Z value is plotted as a node (Scatter Series). // The general Gaussian disrtibution of the predictions of each formula is plotted with a continuous line (Line Series). var scatterSeries1 = new ScatterSeries(); scatterSeries1.MarkerStrokeThickness = 2; scatterSeries1.MarkerType = MarkerType.Circle; scatterSeries1.MarkerFill = OxyColor.FromRgb(216, 0, 115); scatterSeries1.Title = "Nikolaev - Dmitriev [Foil]"; var lineSeries1 = new LineSeries(); lineSeries1.MarkerStrokeThickness = 2; lineSeries1.LineStyle = LineStyle.LongDash; lineSeries1.Color = OxyColor.FromRgb(216, 0, 115); var scatterSeries2 = new ScatterSeries(); scatterSeries2.MarkerStrokeThickness = 2; scatterSeries2.MarkerType = MarkerType.Square; scatterSeries2.MarkerFill = OxyColor.FromRgb(0, 80, 239); scatterSeries2.Title = "Sayer [Foil]"; var lineSeries2 = new LineSeries(); lineSeries2.MarkerStrokeThickness = 2; lineSeries2.LineStyle = LineStyle.LongDash; lineSeries2.Color = OxyColor.FromRgb(0, 80, 239); var scatterSeries3 = new ScatterSeries(); scatterSeries3.MarkerStrokeThickness = 2; scatterSeries3.MarkerType = MarkerType.Triangle; scatterSeries3.MarkerFill = OxyColor.FromRgb(96, 169, 23); scatterSeries3.Title = "Betz [Foil]"; var lineSeries3 = new LineSeries(); lineSeries3.MarkerStrokeThickness = 2; lineSeries3.LineStyle = LineStyle.LongDash; lineSeries3.Color = OxyColor.FromRgb(96, 169, 23); var scatterSeries4 = new ScatterSeries(); scatterSeries4.MarkerStrokeThickness = 2; scatterSeries4.MarkerType = MarkerType.Circle; scatterSeries4.MarkerFill = OxyColor.FromRgb(240, 163, 10); scatterSeries4.Title = "Schiwietz - Schmitt [Foil]"; var lineSeries4 = new LineSeries(); lineSeries4.MarkerStrokeThickness = 2; lineSeries4.LineStyle = LineStyle.LongDash; lineSeries4.Color = OxyColor.FromRgb(240, 163, 10); var scatterSeries5 = new ScatterSeries(); scatterSeries5.MarkerStrokeThickness = 2; scatterSeries5.MarkerType = MarkerType.Diamond; scatterSeries5.MarkerFill = OxyColor.FromRgb(100, 118, 135); scatterSeries5.Title = "Sayer [Gas]"; var lineSeries5 = new LineSeries(); lineSeries5.MarkerStrokeThickness = 2; lineSeries5.LineStyle = LineStyle.LongDash; lineSeries5.Color = OxyColor.FromRgb(100, 118, 135); var scatterSeries6 = new ScatterSeries(); scatterSeries6.MarkerStrokeThickness = 2; scatterSeries6.MarkerType = MarkerType.Diamond; scatterSeries6.MarkerFill = OxyColor.FromRgb(130, 90, 44); scatterSeries6.Title = "Schiwietz - Schmitt [Gas]"; var lineSeries6 = new LineSeries(); lineSeries6.MarkerStrokeThickness = 2; lineSeries6.LineStyle = LineStyle.LongDash; lineSeries6.Color = OxyColor.FromRgb(130, 90, 44); for (int i = 0; i < z; i++) // Adding the data points to each data scatter series. { scatterSeries1.Points.Add(new OxyPlot.DataPoint(data_list[i][0], data_list[i][1])); scatterSeries2.Points.Add(new OxyPlot.DataPoint(data_list[i][0], data_list[i][3])); scatterSeries3.Points.Add(new OxyPlot.DataPoint(data_list[i][0], data_list[i][5])); if (z < 6) { scatterSeries4.Points.Add(new OxyPlot.DataPoint(data_list[i][0], data_list[i][7])); } scatterSeries5.Points.Add(new OxyPlot.DataPoint(data_list[i][0], data_list[i][9])); if (z < 6) { scatterSeries6.Points.Add(new OxyPlot.DataPoint(data_list[i][0], data_list[i][11])); } } double y_axis_maximum = -1000; for (double j = 0; j < z; j += 0.01) // Adding the data points to each data line series and derivation of the maximum the data values. { //double dataPoint_nd = gaussian_fit(j + 1.0, qmean_nd, d_nd)/sum_gaussian_values("nd"); //double dataPoint_s_foil = gaussian_fit(j + 1.0, qmean_s_foil, d_s_foil) / sum_gaussian_values("s_foil"); //double dataPoint_b = gaussian_fit(j + 1.0, qmean_b, d_b)/sum_gaussian_values("b"); //double dataPoint_s_gas = gaussian_fit(j + 1.0, qmean_s_gas, d_s_gas) / sum_gaussian_values("s_gas"); double dataPoint_nd = gaussian_fit_nd(j + 1.0, qmean_nd, d_nd) / sum_nd; double dataPoint_s_foil = gaussian_fit_s(j + 1.0, qmean_s_foil, rc, epc) / sum_s_foil; double dataPoint_b = gaussian_fit_b_ss(j + 1.0, qmean_b, d_b) / sum_b; double dataPoint_ss_foil = gaussian_fit_b_ss(j + 1.0, qmean_ss_foil, d_ss) / sum_ss_foil; double dataPoint_s_gas = gaussian_fit_s(j + 1.0, qmean_s_gas, rg, epg) / sum_s_gas; double dataPoint_ss_gas = gaussian_fit_b_ss(j + 1.0, qmean_ss_gas, d_ss) / sum_ss_gas; if (dataPoint_nd > y_axis_maximum) { y_axis_maximum = dataPoint_nd; } if (dataPoint_s_foil > y_axis_maximum) { y_axis_maximum = dataPoint_s_foil; } if (dataPoint_b > y_axis_maximum) { y_axis_maximum = dataPoint_b; } if (dataPoint_s_gas > y_axis_maximum) { y_axis_maximum = dataPoint_s_gas; } if (dataPoint_ss_foil > y_axis_maximum) { y_axis_maximum = dataPoint_ss_foil; } if (dataPoint_ss_gas > y_axis_maximum) { y_axis_maximum = dataPoint_ss_gas; } lineSeries1.Points.Add(new OxyPlot.DataPoint(j + 1.0, dataPoint_nd)); lineSeries2.Points.Add(new OxyPlot.DataPoint(j + 1.0, dataPoint_s_foil)); lineSeries3.Points.Add(new OxyPlot.DataPoint(j + 1.0, dataPoint_b)); if (z < 6) { lineSeries4.Points.Add(new OxyPlot.DataPoint(j + 1.0, dataPoint_ss_foil)); } lineSeries5.Points.Add(new OxyPlot.DataPoint(j + 1.0, dataPoint_s_gas)); if (z < 6) { lineSeries6.Points.Add(new OxyPlot.DataPoint(j + 1.0, dataPoint_ss_gas)); } } var linearAxis1 = new LinearAxis(); linearAxis1.Maximum = z + (1.0); //Setting the x axis maximum at (z+1) linearAxis1.Minimum = 1.0; linearAxis1.Position = AxisPosition.Bottom; plotModel1.Axes.Add(linearAxis1); var linearAxis2 = new LinearAxis(); linearAxis2.Maximum = y_axis_maximum + (y_axis_maximum * 0.1); //Setting the y axis maximum at 10% over the maximum data value. linearAxis2.Minimum = 0; linearAxis2.Position = AxisPosition.Left; plotModel1.Axes.Add(linearAxis2); plotModel1.Series.Add(lineSeries1); plotModel1.Series.Add(lineSeries2); plotModel1.Series.Add(lineSeries3); plotModel1.Series.Add(lineSeries4); plotModel1.Series.Add(lineSeries5); plotModel1.Series.Add(lineSeries6); plotModel1.Series.Add(scatterSeries1); plotModel1.Series.Add(scatterSeries2); plotModel1.Series.Add(scatterSeries3); plotModel1.Series.Add(scatterSeries4); plotModel1.Series.Add(scatterSeries5); plotModel1.Series.Add(scatterSeries6); var functionAnnotation1 = new FunctionAnnotation(); functionAnnotation1.Color = OxyColor.FromRgb(216, 0, 115); functionAnnotation1.StrokeThickness = 2; functionAnnotation1.Text = "Nikolaev-Dmitriev Data [Foil Stripping]"; plotModel1.Annotations.Add(functionAnnotation1); var functionAnnotation2 = new FunctionAnnotation(); functionAnnotation2.Type = FunctionAnnotationType.EquationY; functionAnnotation2.Color = OxyColor.FromRgb(0, 80, 239); functionAnnotation2.StrokeThickness = 2; functionAnnotation2.Text = "Sayer's Data [Foil Stripping]"; plotModel1.Annotations.Add(functionAnnotation2); var functionAnnotation3 = new FunctionAnnotation(); functionAnnotation3.Color = OxyColor.FromRgb(96, 169, 23); functionAnnotation3.StrokeThickness = 2; functionAnnotation3.Text = "Betz's Data [Foil Stripping]"; plotModel1.Annotations.Add(functionAnnotation3); var functionAnnotation4 = new FunctionAnnotation(); functionAnnotation4.Type = FunctionAnnotationType.EquationY; functionAnnotation4.Color = OxyColor.FromRgb(109, 135, 100); functionAnnotation4.StrokeThickness = 2; functionAnnotation4.Text = "Schiwietz - Schmitt Data [Foil Stripper]"; plotModel1.Annotations.Add(functionAnnotation4); var functionAnnotation5 = new FunctionAnnotation(); functionAnnotation5.Type = FunctionAnnotationType.EquationY; functionAnnotation5.Color = OxyColor.FromRgb(100, 118, 135); functionAnnotation5.StrokeThickness = 2; functionAnnotation5.Text = "Sayer's Data [Gas Stripping]"; plotModel1.Annotations.Add(functionAnnotation5); var functionAnnotation6 = new FunctionAnnotation(); functionAnnotation6.Type = FunctionAnnotationType.EquationY; functionAnnotation6.Color = OxyColor.FromRgb(130, 90, 44); functionAnnotation6.StrokeThickness = 2; functionAnnotation6.Text = "Schiwietz - Schmitt Data [Gas Stripping]"; plotModel1.Annotations.Add(functionAnnotation6); return(plotModel1); }