private void PopulateProcDATSheet(LJVScanVM scan) { string legendName = string.Concat(scan.TheLJVScan.Pixel.Device.Label, scan.TheLJVScan.Pixel.Site.Replace("Site", string.Empty)); activeSheet.Cols = 7; activeSheet.Columns[0].LongName = "Voltage"; activeSheet.Columns[1].LongName = "Current Density"; activeSheet.Columns[2].LongName = "Photocurrent"; activeSheet.Columns[3].LongName = "Luminance"; activeSheet.Columns[4].LongName = "Current Eff."; activeSheet.Columns[5].LongName = "Power Eff."; activeSheet.Columns[6].LongName = "EQE"; activeSheet.Columns[0].Units = "V"; activeSheet.Columns[1].Units = "mA/cm²"; activeSheet.Columns[2].Units = "A"; activeSheet.Columns[3].Units = "cd/m²"; activeSheet.Columns[4].Units = "cd/A"; activeSheet.Columns[5].Units = "lm/W"; activeSheet.Columns[6].Units = "%"; activeSheet.Columns[0].Comments = legendName; activeSheet.Columns[1].Comments = legendName; activeSheet.Columns[2].Comments = legendName; activeSheet.Columns[3].Comments = legendName; activeSheet.Columns[4].Comments = legendName; activeSheet.Columns[5].Comments = legendName; activeSheet.Columns[6].Comments = legendName; activeSheet.SetData(scan.ProcDatArray(), 0, 0); }
private void PopulateCompareSheetThenPlotXY(ProcDATField xval, ProcDATField 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 * 2; 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; foreach (LJVScan scan in ss.LJVScans) { LJVScanVM vm = new LJVScanVM(scan); var array = vm.ProcDatArray(); activeSheet.Columns[colsCounter].LongName = ProcDATLongNames[xval]; activeSheet.Columns[colsCounter].Type = COLTYPES.COLTYPE_X; activeSheet.Columns[colsCounter].Units = ProcDATUnits[xval]; activeSheet.SetData(array.GetCol((int)xval), 0, colsCounter); activeSheet.Columns[colsCounter + 1].LongName = ProcDATLongNames[yval]; activeSheet.Columns[colsCounter + 1].Type = COLTYPES.COLTYPE_Y; activeSheet.Columns[colsCounter + 1].Units = ProcDATUnits[yval]; activeSheet.Columns[colsCounter + 1].Comments = string.Concat(d.Label, scan.Pixel.Site.Replace("Site", string.Empty)); activeSheet.SetData(array.GetCol((int)yval), 0, colsCounter + 1); 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); 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 += 2; lineStyleCounter++; } } } colorCounter++;//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(); } }