public override DataSet Clone() { NglXml1 cln = ((NglXml1)(base.Clone())); cln.InitVars(); return(cln); }
private ChartData[] ReadXmlv2(string xml) { NextGenLab.DataSets.NglXml1 nx = new NextGenLab.DataSets.NglXml1(); nx.DataSetName = "NglXml1"; nx.Locale = new System.Globalization.CultureInfo("en-US"); nx.ReadXml(new MemoryStream(Encoding.Unicode.GetBytes(xml))); if (nx.Results.Count > 1) { throw new Exception("To many results, can't handle more than one"); } if (nx.Results.Count == 0) { throw new ArgumentException("Can't find any results!!"); } NglXml1.Plot[] plots = nx.Results[0].GetPlots(); ChartData[] charts = new ChartData[plots.Length]; NglXml1.Plot p; ChartData cd; Widths = new int[plots.Length]; Heights = new int[plots.Length]; for (int j = 0; j < plots.Length; j++) { p = plots[j]; cd = ChartData.GetInstance(); NglXml1.YVal[] yv = p.GetYVals(); cd.Y = new double[yv.Length][]; for (int i = 0; i < yv.Length; i++) { cd.Y[i] = ParseValueString(yv[i].Y); } cd.X = ParseValueString(p.X); cd.Title = p.YLabel; cd.TitleX = p.XLabel; cd.AxisLabelX = "[" + p.XUnit + "]"; cd.AxisLabelY = "[" + p.YUnit + "]"; cd.AxisTypeX = (AxisType)Enum.Parse(typeof(AxisType), p.XScale, true); cd.AxisTypeY = (AxisType)Enum.Parse(typeof(AxisType), p.YScale, true); switch (cd.AxisTypeX) { case AxisType.LOG: cd.AxisRangeX = GraphMath.TransformNoScale(cd.X); break; case AxisType.LIN: cd.AxisRangeX = GraphMath.Transform(cd.X); break; } switch (cd.AxisTypeY) { case AxisType.LOG: cd.AxisRangeY = GraphMath.TransformNoScale(cd.Y); break; case AxisType.LIN: cd.AxisRangeY = GraphMath.Transform(cd.Y); break; } Widths[j] = p.Width; Heights[j] = p.Height; cd.ShowZero = true; charts[j] = cd; } return(charts); }