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(); }
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(); }
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(); }
private void FormatXYGraph() { activeGraphLayer1.Execute("layer.x.opposite = 1"); activeGraphLayer1.Execute("layer.x.thickness = 3"); activeGraphLayer1.Execute("layer.y.opposite = 1"); activeGraphLayer1.Execute("layer.y.showAxes = 3"); activeGraphLayer1.Execute("layer.x.label.pt = 25"); activeGraphLayer1.Execute("layer.y.label.pt = 25"); activeGraphLayer1.Execute("layer.x.ticks = 5"); activeGraphLayer1.Execute("layer.y.ticks = 5"); activeGraphLayer1.Execute("XB.fsize = 35"); activeGraphLayer1.Execute("YL.fsize = 35"); activeGraphLayer1.Execute("Rescale"); activeGraphLayer1.Execute("layer.y.rescale()"); activeGraphLayer1.Execute("legendupdate dest:=layer update:=reconstruct mode:=comment"); }
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(); } }