Add a data plot or a group of data plots to the graph layer.
VB: Function Add(dr As DataRange, plottype As ByVal PLOTTYPES ) As DataPlot
C++: DataPlot Add(DataRange dr, PLOTTYPES plottype )
C#: DataPlot Add(DataRange dr, PLOTTYPES plottype )
Plots a scatter plot using scatter template
Sub CommandButton1_Click() Dim app As Origin.Application Dim wks As Origin.Worksheet Set app = New Origin.ApplicationSI 'Add a WorksheetPage, which will have one Worksheet by default Set wks = app.WorksheetPages.Add().Layers(0) Dim bRet As Boolean Dim ii As Integer Dim exlRange As Excel.range 'Copy col A,B from excel to Origin Wks as XY columns 'col A1 in Excel -> col(1) in Origin For ii = 1 To 2 Set exlRange = Worksheets("Sheet1").Columns(ii) bRet = wks.SetData(exlRange.Value, 0, ii - 1) Next 'set column designations in Origin first before we can plot them wks.Columns(0).Type = COLTYPE_X wks.Columns(1).Type = COLTYPE_Y Dim glay As Origin.GraphLayer Dim dr As Origin.DataRange Dim dp As Origin.DataPlot 'create a new graph page using Scatter template Set glay = wks.Application.GraphPages.Add("Scatter").Layers(0) Set dr = wks.NewDataRange(0, 0, -1, 1) 'create range to be plotted, all rows,A,B Set dp = glay.DataPlots.Add(dr, IDM_PLOT_UNKNOWN) End Sub
8.0SR2