public override List <ChartData> OnPlot(ReportNode rp) { PlotType = this.Name; List <ChartData> cds = new List <ChartData>(); ChartData cd = ChartData.GetInstance(); List <double> time = rp.GetPlot(rp.DefaultXAxis); List <double> values = rp.GetPlot(this.Name); cd.TitlesY = new string[] { this.Name }; if (time != null && time.Count == values.Count) { cd.TitleX = rp.DefaultXAxis; cd.AxisLabelX = "[s]"; cd.X = time.ToArray(); } else { cd.TitleX = "Sample"; double[] x = new double[values.Count]; for (int i = 0; i < x.Length; i++) { x[i] = i; } cd.AxisLabelX = "[n]"; cd.X = x; } cd.Y = new double[][] { values.ToArray() }; cds.Add(cd); return(cds); }
public override List <ChartData> OnPlot(ReportNode rp) { PlotType = xaxis + " VS DERIV(" + yaxis + ")"; List <ChartData> cds = new List <ChartData>(); ChartData cd = ChartData.GetInstance(); cd.TitlesY = new string[] { "d(" + yaxis + ")/dx:" }; List <double> chxaxis = rp.GetPlot(xaxis); List <double> chyaxis = rp.GetPlot(yaxis); double[] deriv = new double[chxaxis.Count - 1]; for (int i = 0; i < deriv.Length; i++) { deriv[i] = (chyaxis[i + 1] - chyaxis[i]) / (chxaxis[i + 1] - chxaxis[i]); } double[] xvals = new double[deriv.Length]; chxaxis.CopyTo(0, xvals, 0, deriv.Length); cd.TitleX = xaxis; cd.X = xvals; cd.Y = new double[][] { deriv }; cds.Add(cd); return(cds); }
public override List <NextGenLab.Chart.ChartData> OnPlot(ReportNode rp) { string str = ""; switch (rmstype) { case RMSType.Simple: PrintRMS rms = new PrintRMS(); str = rms.Print(this.Name, rp.GetPlot(this.Name)); break; case RMSType.SNRfromRMS: List <double> chxaxis = rp.GetPlot(xaxis); List <double> chyaxis = rp.GetPlot(yaxis); PrintSnrFromRMS psrm = new PrintSnrFromRMS(0, ""); str = psrm.Print(xaxis, chxaxis, yaxis, chyaxis); break; } MessageBox.Show(str); return(new List <ChartData>()); }
public override List <ChartData> OnPlot(ReportNode rp) { List <ChartData> cds = new List <ChartData>(); PlotType = "Plot ("; foreach (string s in selectedkeys) { PlotType += s + ","; } PlotType = PlotType.Remove(PlotType.Length - 1); PlotType += ")"; if (selectedkeys == null || selectedkeys.Count < 1) { return(null); } ChartData cd = ChartData.GetInstance(); cd.Title = ""; cd.TitlesY = selectedkeys.ToArray(); cd.TitleX = "Sample"; double[][] yval = new double[selectedkeys.Count][]; int maxlength = int.MinValue; for (int i = 0; i < selectedkeys.Count; i++) { yval[i] = rp.GetPlot(selectedkeys[i]).ToArray();// plots[selectedkeys[i]].ToArray(); if (maxlength < yval[i].Length) { maxlength = yval[i].Length; } } cd.Y = yval; List <double> time = rp.GetPlot("Time"); if (time != null && time.Count == maxlength) { cd.TitleX = "Time"; cd.AxisLabelX = "[s]"; cd.X = time.ToArray(); } else { cd.TitleX = "Sample"; double[] x = new double[maxlength]; for (int i = 0; i < x.Length; i++) { x[i] = i; } cd.AxisLabelX = "[n]"; cd.X = x; } cds.Add(cd); return(cds); }
public override List <ChartData> OnPlot(ReportNode rp) { List <ChartData> cds = new List <ChartData>(); ChartData cd = ChartData.GetInstance(); List <double> chxaxis = rp.GetPlot(xaxis); List <double> chyaxis = rp.GetPlot(yaxis); List <double> chzaxis = rp.GetPlot(zaxis); SortedDictionary <string, List <double> > ys = new SortedDictionary <string, List <double> >(); double[] tmp = new double[chxaxis.Count]; List <double> dtmp; string k; for (int i = 0; i < chzaxis.Count; i++) { if (chzaxis[i] == 0) { continue; } k = (chzaxis[i] / 1e-6).ToString(); dtmp = new List <double>(); dtmp.AddRange(tmp); if (!ys.ContainsKey(k)) { ys.Add(k, dtmp); } ys[k][i] = chyaxis[i]; } string[] keys = new string[ys.Keys.Count]; double[][] yvals = new double[ys.Keys.Count][]; int z = 0; foreach (string key in ys.Keys) { keys[z] = key; yvals[z] = ys[key].ToArray(); z++; } cd.TitlesY = keys; cd.TitleX = xaxis; cd.X = chxaxis.ToArray(); cd.Y = yvals; cds.Add(cd); return(cds); }
void AddAll(ReportNode rn) { List <List <double> > ml = new List <List <double> >(); DataGridViewColumn dc; List <double> dl; int max = 0; foreach (string s in rn.PlotKeys) { dc = new DataGridViewTextBoxColumn(); dc.HeaderText = s; dc.ReadOnly = true; dl = rn.GetPlot(s); if (max < dl.Count) { max = dl.Count; } ml.Add(dl); dc.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; this.dataGridView1.Columns.Add(dc); } object[] da; for (int i = 0; i < max; i++) { da = new object[ml.Count]; for (int z = 0; z < ml.Count; z++) { da[z] = ml[z][i]; } this.dataGridView1.Rows.Add(da); } }
public override List <ChartData> OnPlot(ReportNode rp) { PlotType = "Difference (" + xaxis + " - " + yaxis + ")"; List <ChartData> cds = new List <ChartData>(); ChartData cd = ChartData.GetInstance(); cd.TitlesY = new string[] { xaxis + " - " + yaxis }; List <double> chxaxis = rp.GetPlot(xaxis); List <double> chyaxis = rp.GetPlot(yaxis); List <double> time = rp.GetPlot("Time"); if (time != null && time.Count == chxaxis.Count) { cd.TitleX = "Time"; cd.AxisLabelX = "[s]"; cd.X = time.ToArray(); } else { cd.TitleX = "Sample"; double[] x = new double[chxaxis.Count]; for (int i = 0; i < x.Length; i++) { x[i] = i; } cd.AxisLabelX = "[n]"; cd.X = x; } double[] y = new double[chxaxis.Count]; for (int i = 0; i < chxaxis.Count; i++) { if (chyaxis.Count > i) { y[i] = chxaxis[i] - chyaxis[i]; } } cd.Y = new double[][] { y }; cds.Add(cd); return(cds); }
public override List <NextGenLab.Chart.ChartData> OnPlot(ReportNode rp) { PrintDynamicParameters pdp = new PrintDynamicParameters(f0, fs, fmin, fmax, true); string s = pdp.Print(this.Name, rp.GetPlot(this.Name)); MessageBox.Show(s); return(new List <ChartData>()); }
public override List <ChartData> OnPlot(ReportNode rp) { PlotType = "Spectral Density (" + this.Name + ")"; PlotPowerSpectralDensity psd = new PlotPowerSpectralDensity(fs, true, max_amplitude); psd.Title = this.Name; List <ChartData> cds = psd.Plot(rp.GetPlot(this.Name)); return(cds); }
public override List <ChartData> OnPlot(ReportNode rp) { PlotType = xaxis + " VS " + yaxis; List <ChartData> cds = new List <ChartData>(); ChartData cd = ChartData.GetInstance(); cd.TitlesY = new string[] { yaxis }; List <double> chxaxis = rp.GetPlot(xaxis); List <double> chyaxis = rp.GetPlot(yaxis); cd.TitleX = xaxis; cd.X = chxaxis.ToArray(); cd.Y = new double[][] { chyaxis.ToArray() }; cds.Add(cd); return(cds); }
public override List <NextGenLab.Chart.ChartData> OnPlot(ReportNode rp) { PlotType = momenttype.ToString() + "(" + this.Name + ")"; ChartData cd = ChartData.GetInstance(); List <double> values = rp.GetPlot(this.Name); double[] meanlist = Mean(values); cd.Y = new double[][] { meanlist }; cd.TitlesY = new string[] { this.Name }; cd.TitleX = "Sample"; double[] x = new double[values.Count]; for (int i = 0; i < x.Length; i++) { x[i] = i; } cd.AxisLabelX = "[n]"; cd.X = x; List <ChartData> cds = new List <ChartData>(); cds.Add(cd); return(cds); }
public override List <ChartData> OnPlot(ReportNode rp) { PlotType = this.Name; List <ChartData> cds = new List <ChartData>(); ChartData cd = ChartData.GetInstance(); List <double> values = rp.GetPlot(this.Name); //Set bin count histCount = values.Count / 100; if (histCount < 10) { histCount = 10; } //Find Min and Max double max = double.MinValue; double min = double.MaxValue; foreach (double d in values) { if (d > max) { max = d; } if (d < min) { min = d; } } if (min == max) { return(cds); } ; //Place values into bins double[] vals = new double[histCount + 1]; double step = (max - min) / ((double)histCount); double vmax = double.MinValue; foreach (double d in values) { int v = ((int)Math.Round((d - min) / step)); vals[v] += 1; if (vals[v] > vmax) { vmax = vals[v]; } } List <double> xval = new List <double>(histCount + 1); for (int i = 0; i < (histCount + 1); i++) { xval.Add(min + step * i); } cd.TitleX = this.Name; cd.X = xval.ToArray(); if (histType == HistogramType.WithNormalDist) { double um, sigma; MathStatistics.MeanStandardDeviation(values, out um, out sigma); double[] norm_vals = new double[histCount + 1]; double vl_max = double.MinValue; cd.TitlesY = new string[] { "Count (u=" + um.ToString("e2") + ",std=" + sigma.ToString("e2") + ")", "Normal distribution" }; for (int i = 0; i < (histCount + 1); i++) { double vl = 1 / (sigma * Math.Sqrt(2 * Math.PI)) * Math.Exp(-Math.Pow(xval[i] - um, 2) / (2 * Math.Pow(sigma, 2))); norm_vals[i] = vl; if (vl > vl_max) { vl_max = vl; } } for (int i = 0; i < (histCount + 1); i++) { norm_vals[i] = norm_vals[i] * vmax / vl_max; } cd.Y = new double[][] { vals, norm_vals }; } else { double um, sigma; MathStatistics.MeanStandardDeviation(values, out um, out sigma); cd.ChartType = ChartType.Stem; cd.TitlesY = new string[] { this.Name + " ( u=" + um.ToString("e2") + ",std=" + sigma.ToString("e2") + ") " }; cd.Y = new double[][] { vals }; } cds.Add(cd); return(cds); }