public DataPlot LoadFromFile(string path) { DataPlot dataPlot = new DataPlot(); GameObject.FindGameObjectWithTag("Finish").GetComponent <Text>().text = "Loading " + path; //using (var reader = new StreamReader(path)) //{ // GameObject.FindGameObjectWithTag("Finish").GetComponent<Text>().text = "Loading 1"; // dataPlot = Load(reader.ReadToEnd()); //} StreamReader reader = null; try { reader = new StreamReader(path); dataPlot = Load(reader.ReadToEnd()); } catch (Exception e) { GameObject.FindGameObjectWithTag("Finish").GetComponent <Text>().text = e.Message; } finally { if (reader != null) { reader.Dispose(); } } return(dataPlot); }
private void PlotJV(string plotName, bool plottingCompare = false) { String strGrName = string.Concat(plotName, "JV"); activeGraphLayer1 = originApp.FindGraphLayer(strGrName); if (activeGraphLayer1 == null) { strGrName = (String)originApp.CreatePage((int)Origin.PAGETYPES.OPT_GRAPH, strGrName, "Scatter", 2); } activeGraphLayer1 = (GraphLayer)originApp.GraphPages[strGrName].Layers[0]; //prepare JVDataRange DataRange jvdr = activeSheet.NewDataRange(); jvdr.Add("X", activeSheet, 0, 0, -1, 0); //3rd column (L) jvdr.Add("Y", activeSheet, 0, 1, -1, 1); //6th column (EQE) String strPlotName = string.Concat(plotName, "JV_Scatter"); activeDataPlot = activeGraphLayer1.DataPlots[strPlotName]; activeDataPlot = activeGraphLayer1.DataPlots.Add(jvdr, PLOTTYPES.IDM_PLOT_LINESYMB); //activeDataPlot.Execute(string.Concat("set ", strPlotName, " -c 101")); activeGraphLayer1.Execute(string.Concat("set ", activeDataPlot.Name, " -c color(", plotColors[colorCounter], ")")); FormatXYGraph(); //set log scale (type = 2) activeGraphLayer1.Execute("layer.x.type = 2"); activeGraphLayer1.Execute("layer.y.type = 2"); }
private void PlotEQEL(string plotName) { String strGrName = string.Concat(plotName, "EQEL"); activeGraphLayer1 = originApp.FindGraphLayer(strGrName); if (activeGraphLayer1 == null) { strGrName = (String)originApp.CreatePage((int)Origin.PAGETYPES.OPT_GRAPH, strGrName, "Scatter", 2); } activeGraphLayer1 = (GraphLayer)originApp.GraphPages[strGrName].Layers[0]; //prepare JVDataRange DataRange eqeldr = activeSheet.NewDataRange(); eqeldr.Add("X", activeSheet, 0, 3, -1, 3); //3rd column (L) eqeldr.Add("Y", activeSheet, 0, 6, -1, 6); //6th column (EQE) String strPlotName = string.Concat(plotName, "EQEL_Scatter"); activeDataPlot = activeGraphLayer1.DataPlots[strPlotName]; if (activeDataPlot == null) { activeDataPlot = activeGraphLayer1.DataPlots.Add(eqeldr, PLOTTYPES.IDM_PLOT_LINESYMB); //activeDataPlot.Execute(string.Concat("set ", strPlotName, " -c 101")); activeDataPlot.Execute(string.Concat("set -csf 2")); } activeGraphLayer1.Execute(string.Concat("set ", activeDataPlot.Name, " -c color(", plotColors[colorCounter], ")")); FormatXYGraph(); }
private void PlotLJV(string plotName) { String strGrName = string.Concat(plotName, "LJV"); activeGraphLayer1 = originApp.FindGraphLayer(strGrName); if (activeGraphLayer1 == null) { strGrName = (String)originApp.CreatePage((int)Origin.PAGETYPES.OPT_GRAPH, strGrName, "DoubleY", 2); } activeGraphLayer1 = (GraphLayer)originApp.GraphPages[strGrName].Layers[0]; activeGraphLayer2 = (GraphLayer)originApp.GraphPages[strGrName].Layers[1]; //prepare JVDataRange DataRange jvdr = activeSheet.NewDataRange(0, 0, -1, 1); DataRange lvdr = activeSheet.NewDataRange(); lvdr.Add("X", activeSheet, 0, 0, -1, 0); //add 1st column (V) data lvdr.Add("Y", activeSheet, 0, 3, -1, 3); //3rd column (L) String strPlotName = string.Concat(plotName, "LJV Scatter"); activeDataPlot = activeGraphLayer1.DataPlots[strPlotName]; activeDataPlot = activeGraphLayer1.DataPlots.Add(jvdr, PLOTTYPES.IDM_PLOT_LINESYMB); activeGraphLayer1.Execute(string.Concat("set ", activeDataPlot.Name, " -c color(", plotColors[colorCounter], ")")); activeDataPlot = activeGraphLayer2.DataPlots.Add(lvdr, PLOTTYPES.IDM_PLOT_LINESYMB); activeGraphLayer2.Execute(string.Concat("set ", activeDataPlot.Name, " -c color(", plotColors[colorCounter], ")")); activeGraphLayer2.Execute(string.Concat("set ", activeDataPlot.Name, " -k 4"));//change symbol for luminance to triangle activeGraphLayer1.Execute("layer.y.type = 2"); activeGraphLayer1.Execute("Rescale"); activeGraphLayer1.Execute("layer.y.rescale()"); activeGraphLayer1.Execute("legendupdate dest:=layer update:=reconstruct mode:=comment"); activeGraphLayer2.Execute("legendupdate dest:=layer update:=reconstruct mode:=comment"); activeGraphLayer2.Execute("Rescale"); }
void PlotELSpec(string strGrName) { activeGraphLayer1 = originApp.FindGraphLayer(strGrName); if (activeGraphLayer1 == null) { strGrName = (String)originApp.CreatePage((int)Origin.PAGETYPES.OPT_GRAPH, strGrName, "Scatter", 2); } activeGraphLayer1 = (GraphLayer)originApp.GraphPages[strGrName].Layers[0]; DataRange eldr = activeSheet.NewDataRange(); Debug.WriteLine("Convert.ToInt32(activeELSpecVM.MinLambdaCutoff): " + Convert.ToInt32(activeELSpecVM.MinLambdaCutoff)); var minLam = activeELSpecVM.ELSpecList.IndexOf(activeELSpecVM.ELSpecList.Where(x => x.Wavelength == activeELSpecVM.MinLambdaCutoff).FirstOrDefault()); var maxLam = activeELSpecVM.ELSpecList.IndexOf(activeELSpecVM.ELSpecList.Where(x => x.Wavelength == activeELSpecVM.MaxLambdaCutoff).FirstOrDefault()); eldr.Add("X", activeSheet, minLam, 0, maxLam, 0);//add data for X column eldr.Add("Y", activeSheet, minLam, 1, maxLam, 1); String strPlotName = string.Concat(strGrName, "_plot"); activeDataPlot = activeGraphLayer1.DataPlots[strPlotName]; activeDataPlot = activeGraphLayer1.DataPlots.Add(eldr, PLOTTYPES.IDM_PLOT_LINESYMB); activeGraphLayer1.Execute(string.Concat("set ", activeDataPlot.Name, " -c color(", plotColors[colorCounter], ")")); activeGraphLayer1.Execute("Rescale"); activeGraphLayer1.Execute("layer.y.rescale()"); activeGraphLayer1.Execute("legendupdate dest:=layer update:=reconstruct mode:=comment"); FormatXYGraph(); }
/// <summary> /// Updates the label execute. /// </summary> void UpdateLabelExecute() { var tupleResults = solveTuple.ResultsTuple(UpdateTextBox); UpdateLabel = tupleResults.Item1; double a, b, c; a = solveTuple.a; b = solveTuple.b; c = solveTuple.c; listViewCollection.Add(new ListViewData { ListView_No = indexHistory.ToString(), ListView_a = a.ToString(), ListView_b = b.ToString(), ListView_c = c.ToString(), ListView_Discriminant = solveTuple.Discriminant.ToString(), ListView_x1 = tupleResults.Item2, ListView_x2 = tupleResults.Item3, ListView_Datetime = DateTime.Now }); indexHistory++; if (ClearEnable == true) { DataPlot.Clear(); //clears old collection before drawing new collection } DrawingCollecionLambdaExpressionWithAllCoefficients(a, b, c); ClearEnable = true; }
//绘图设置 void SetPlot(EnumerableDataSource <PlotPoint> temp, string title, string yLabel, string path) { DataPlot.AddLineGraph(temp, Colors.Green, 2); PlotTitle.Content = title; PlotYLabel.Content = yLabel; DataLabel.Content = yLabel + ":"; binding.Path = new PropertyPath(path);//path为形参 this.ValueLabel.SetBinding(Label.ContentProperty, binding); }
void DrawingCollecionLambdaExpressionWithAllCoefficients(double a, double b, double c) { for (double x = -10; x <= 10; x += 0.1) { DataPlot.Add(new CollectionDataValuePlot { xDataPlot = x, yDataPlot = y(a, b, c, x) }); } }
public void UpdateData() { try { showData(timeFrame, dateFrom, dateTo, StockId); DataPlot.InvalidatePlot(true); } catch (WebException webEx) { System.Diagnostics.Trace.WriteLine("exc: " + webEx.Message); } }
public void RemoveSelectedData() { var ids = DataPlot.Data.Where(e => e.IsSelected).Select(e => e.Id).ToArray(); if (ids.ToList().Count < 1) { throw new Exception("Please select at least one data from the list"); } foreach (var id in ids) { DataPlot.Remove(id); } }
public void SaveSelectedData(string path) { var ids = DataPlot.Data.Where(e => e.IsSelected).Select(e => e.Id).ToArray(); if (ids.Count() > 0) { DataPlot.SaveChartJson(path, ids); } else { throw new Exception("Please select at least one data from the list"); } }
public DataPlot Load(string path) { DataPlot dataPlot = new DataPlot(); try { var inter = JsonConvert.DeserializeObject <DataIntermediatePlot>(path); dataPlot = new DataPlot(inter); } catch (Exception e) { Debug.Log(e.Message); } return(dataPlot); }
public async void CompareData() { DateTime point = await DataPlot.Pick(); var data = DataPlot.Data.Where(d => d.IsComparable && d.Maximum > point && d.Minimum < point) .Select(d => d.GetDataPoint(point)); if (data.Count() > 0) { string format = "HH:mm:ss on ddd dd'/'MM'/'yyyy"; var model = new PieModel("Power production comparison at " + point.ToString(format, CultureInfo.CreateSpecificCulture("en-US"))); foreach (var d in data) { model.Data.Add(d); } WindowFactory.CreateWindow(model); } }
void PlotFullDATXY(FullDATField xval, FullDATField yval, string strGrName, AxisType xAxis = AxisType.Linear, AxisType yAxis = AxisType.Linear, string plotType = "Scatter", FullDATField yval2 = FullDATField.Luminance) { activeGraphLayer1 = originApp.FindGraphLayer(strGrName); if (activeGraphLayer1 == null) { strGrName = (String)originApp.CreatePage((int)Origin.PAGETYPES.OPT_GRAPH, strGrName, plotType, 2); } activeGraphLayer1 = (GraphLayer)originApp.GraphPages[strGrName].Layers[0]; DataRange dr1 = activeSheet.NewDataRange(); dr1.Add("X", activeSheet, 0, (int)xval, -1, (int)xval);//add data for X column dr1.Add("Y", activeSheet, 0, (int)yval, -1, (int)yval); String strPlotName = string.Concat(strGrName, "_plot"); activeDataPlot = activeGraphLayer1.DataPlots[strPlotName]; activeDataPlot = activeGraphLayer1.DataPlots.Add(dr1, PLOTTYPES.IDM_PLOT_LINESYMB); activeGraphLayer1.Execute(string.Concat("set ", activeDataPlot.Name, " -c color(", plotColors[colorCounter], ")")); if (xAxis == AxisType.Logarithmic) { activeGraphLayer1.Execute("layer.x.type = 2"); } if (yAxis == AxisType.Logarithmic) { activeGraphLayer1.Execute("layer.y.type = 2"); } activeGraphLayer1.Execute("Rescale"); activeGraphLayer1.Execute("layer.y.rescale()"); activeGraphLayer1.Execute("legendupdate dest:=layer update:=reconstruct mode:=comment"); if (plotType == "DoubleY") { activeGraphLayer2 = (GraphLayer)originApp.GraphPages[strGrName].Layers[1]; DataRange dr2 = activeSheet.NewDataRange(); dr2.Add("X", activeSheet, 0, (int)xval, -1, (int)xval);//add data for X column dr2.Add("Y", activeSheet, 0, (int)yval2, -1, (int)yval2); activeDataPlot = activeGraphLayer2.DataPlots.Add(dr2, PLOTTYPES.IDM_PLOT_LINESYMB); activeGraphLayer2.Execute(string.Concat("set ", activeDataPlot.Name, " -c color(", plotColors[colorCounter], ")")); activeGraphLayer2.Execute(string.Concat("set ", activeDataPlot.Name, " -k 4"));//change symbol for luminance to triangle activeGraphLayer2.Execute("legendupdate dest:=layer update:=reconstruct mode:=comment"); activeGraphLayer2.Execute("Rescale"); } FormatXYGraph(); }
private void PlotCEJ(string plotName) { String strGrName = string.Concat(plotName, "CEJ"); activeGraphLayer1 = originApp.FindGraphLayer(strGrName); if (activeGraphLayer1 == null) { strGrName = (String)originApp.CreatePage((int)Origin.PAGETYPES.OPT_GRAPH, strGrName, "Scatter", 2); } activeGraphLayer1 = (GraphLayer)originApp.GraphPages[strGrName].Layers[0]; DataRange cejdr = activeSheet.NewDataRange(); cejdr.Add("X", activeSheet, 0, 1, -1, 1); //2nd column (J) cejdr.Add("Y", activeSheet, 0, 4, -1, 4); //5th column (CE) String strPlotName = string.Concat(plotName, "CEJ_Scatter"); activeDataPlot = activeGraphLayer1.DataPlots[strPlotName]; activeDataPlot = activeGraphLayer1.DataPlots.Add(cejdr, PLOTTYPES.IDM_PLOT_LINESYMB); activeGraphLayer1.Execute(string.Concat("set ", activeDataPlot.Name, " -c color(", plotColors[colorCounter], ")")); FormatXYGraph(); }
public void CreatePoints(string filePath) { _infoText.text = "Hit Me 1"; _dataPlot = LoadJson.Instance.LoadFromFile(filePath); _particles = new Particle[_dataPlot.Particles.Length]; for (int index = 0; index < _dataPlot.Particles.Length; index++) { var p = _dataPlot.Particles[index]; var normal = new Vector4(p.Position.x, p.Position.y, p.Position.z, p.Position.w); normal.Normalize(); _particles[index] = new Particle() { position = normal.StereographicProjection(), color = p.Color, size = p.Size }; } _particleSystem.SetParticles(_particles, _particles.Length); }
public void CreatePoints(string filePath) { _infoText.text = "Hit Me 1"; _dataPlot = LoadJson.Instance.LoadFromFile(filePath); _particles = new Particle[_dataPlot.Particles.Length]; for (int index = 0; index < _dataPlot.Particles.Length; index++) { var p = _dataPlot.Particles[index]; var normal = new Vector4(p.Position.x, p.Position.y, p.Position.z, p.Position.w); normal.Normalize(); _particles[index] = new Particle() { position = normal.StereographicProjection(), color = p.Color, size = p.Size }; } _particleSystem.SetParticles(_particles, _particles.Length); }
public void Start() { _dataPlot = LoadJson.Instance.Load(_jsonData.text); _particles = new Particle[_dataPlot.Particles.Length]; _particleSystem = GetComponent <ParticleSystem>(); _camT = Camera.main.transform; _baseRotation = Quaternion.identity; _rotations = new[] { Quaternion.identity, Quaternion.identity }; _inV = Vector3.zero; _sizeSlider.value = ParticleSize; //Create Points for (int index = 0; index < _dataPlot.Particles.Length; index++) { var p = _dataPlot.Particles[index]; var normal = new Vector4(p.Position.x, p.Position.y, p.Position.z, p.Position.w); normal.Normalize(); _particles[index] = new Particle() { position = normal.StereographicProjection(), color = p.Color, size = p.Size }; } _particleSystem.SetParticles(_particles, _particles.Length); //SelectFile.Instance.FileSelected += CreatePoints; _xPos.text = "0"; _yPos.text = "0"; _zPos.text = "0"; }
public void Start() { _dataPlot = LoadJson.Instance.Load(_jsonData.text); _particles = new Particle[_dataPlot.Particles.Length]; _particleSystem = GetComponent<ParticleSystem>(); _camT = Camera.main.transform; _baseRotation = Quaternion.identity; _rotations = new[] {Quaternion.identity, Quaternion.identity}; _inV = Vector3.zero; _sizeSlider.value = ParticleSize; //Create Points for (int index = 0; index < _dataPlot.Particles.Length; index++) { var p = _dataPlot.Particles[index]; var normal = new Vector4(p.Position.x, p.Position.y, p.Position.z, p.Position.w); normal.Normalize(); _particles[index] = new Particle() { position = normal.StereographicProjection(), color = p.Color, size = p.Size }; } _particleSystem.SetParticles(_particles, _particles.Length); //SelectFile.Instance.FileSelected += CreatePoints; _xPos.text = "0"; _yPos.text = "0"; _zPos.text = "0"; }
public void ClearGraph() { DataPlot.Clear(); }
public void SaveDataImage(string path) { DataPlot.SaveChartImage(path); }
public void SaveData(string path, params int[] ids) { DataPlot.SaveChartJson(path, ids); }
private void PopulateCompareStatsSheetThenPlotXY(StatsDATField xval, StatsDATField yval, string sheetName, AxisType xAxis = AxisType.Linear, AxisType yAxis = AxisType.Linear) { //create worksheet activeSheet = originApp.FindWorksheet(sheetName); if (activeSheet == null) { sheetName = (String)originApp.CreatePage((int)Origin.PAGETYPES.OPT_WORKSHEET, sheetName, "Origin", 2); } activeSheet = (Worksheet)originApp.WorksheetPages[sheetName].Layers[0]; //count columns to create from # of scans int colsCounter = 0; foreach (Device d in dbvm.TheDeviceBatch.Devices) { foreach (DeviceLJVScanSummary ss in d.DeviceLJVScanSummaries) { if (ss.TestCondition == activeTestCondition) { foreach (LJVScan scan in ss.LJVScans) { colsCounter++; } } } } activeSheet.Cols = colsCounter * 3;//xval (mean),yval(mean),yerror (no xerror because messy) colsCounter = 0; //create graph layer String strGrName = string.Concat("graph_", sheetName); activeGraphLayer1 = originApp.FindGraphLayer(strGrName); if (activeGraphLayer1 == null) { strGrName = (String)originApp.CreatePage((int)Origin.PAGETYPES.OPT_GRAPH, strGrName, "Scatter", 2); } activeGraphLayer1 = (GraphLayer)originApp.GraphPages[strGrName].Layers[0]; String strPlotName = string.Concat(strGrName, "_line"); activeDataPlot = activeGraphLayer1.DataPlots[strPlotName]; colorCounter = 0; lineStyleCounter = 0; if (activeSheet.Cols > 0) { //populate columns with data then add DataPlots to GraphLayer foreach (Device d in dbvm.TheDeviceBatch.Devices) { Debug.WriteLine("Plotting " + sheetName + " for " + d.Label); foreach (DeviceLJVScanSummary ss in d.DeviceLJVScanSummaries) { if (ss.TestCondition == activeTestCondition) { lineStyleCounter = 0; LJVScanSummaryVM vm = new LJVScanSummaryVM(ss); var array = vm.StatsDatArray(); activeSheet.Columns[colsCounter].LongName = StatsDATLongNames[xval]; activeSheet.Columns[colsCounter].Type = COLTYPES.COLTYPE_X; activeSheet.Columns[colsCounter].Units = StatsDATUnits[xval]; activeSheet.SetData(array.GetCol((int)xval), 0, colsCounter); activeSheet.Columns[colsCounter + 1].LongName = StatsDATLongNames[yval]; activeSheet.Columns[colsCounter + 1].Type = COLTYPES.COLTYPE_Y; activeSheet.Columns[colsCounter + 1].Units = StatsDATUnits[yval]; activeSheet.Columns[colsCounter + 1].Comments = d.Label; activeSheet.SetData(array.GetCol((int)yval), 0, colsCounter + 1); activeSheet.Columns[colsCounter + 2].Type = COLTYPES.COLTYPE_ERROR;//set y error stuff activeSheet.SetData(array.GetCol((int)yval + 1), 0, colsCounter + 2); DataRange dr = activeSheet.NewDataRange(); dr.Add("X", activeSheet, 0, colsCounter, -1, colsCounter); //add data for X column dr.Add("Y", activeSheet, 0, colsCounter + 1, -1, colsCounter + 1); dr.Add("ED", activeSheet, 0, colsCounter + 2, -1, colsCounter + 2); //ED==origin name for Yerror type XDDDD activeDataPlot = activeGraphLayer1.DataPlots.Add(dr, PLOTTYPES.IDM_PLOT_LINE); activeGraphLayer1.Execute(string.Concat("set ", activeDataPlot.Name, " -c color(", plotColors[colorCounter], ")")); activeGraphLayer1.Execute(string.Concat("set ", activeDataPlot.Name, " -d ", lineStyleCounter)); colsCounter += 3; lineStyleCounter++; } } colorCounter++;//do this to use same line color for each device } if (xAxis == AxisType.Logarithmic) { activeGraphLayer1.Execute("layer.x.type = 2"); } if (yAxis == AxisType.Logarithmic) { activeGraphLayer1.Execute("layer.y.type = 2"); } FormatXYGraph(); } }
public DataPlot LoadFromFile(string path) { DataPlot dataPlot = new DataPlot(); GameObject.FindGameObjectWithTag("Finish").GetComponent<Text>().text = "Loading " + path; //using (var reader = new StreamReader(path)) //{ // GameObject.FindGameObjectWithTag("Finish").GetComponent<Text>().text = "Loading 1"; // dataPlot = Load(reader.ReadToEnd()); //} StreamReader reader = null; try { reader = new StreamReader(path); dataPlot = Load(reader.ReadToEnd()); } catch (Exception e) { GameObject.FindGameObjectWithTag("Finish").GetComponent<Text>().text = e.Message; } finally { if (reader != null) reader.Dispose(); } return dataPlot; }
public void OpenData(string path) { DataPlot.LoadChartJson(path); }
public DataPlot Load(string path) { DataPlot dataPlot = new DataPlot(); try { var inter = JsonConvert.DeserializeObject<DataIntermediatePlot>(path); dataPlot = new DataPlot(inter); } catch (Exception e) { Debug.Log(e.Message); } return dataPlot; }