I import the data from matlab into originlab 2018 to draw. I created a template about drawing styles for "Stacked lines by Y Offsets" styles. Then load the template in MATLAB to plot, but in the resulting figures, all the curves overlap, like the normal multi-Y-axis pattern, and don't draw like "Stacked lines by Y Offsets" templates, and don't know what's wrong. The code is as follows.
% Set data to the columns
invoke(wks, 'SetData', x, 0, 0);
Temp ='D:\ OffsetStackY.otpu';
strGraph = invoke (originObj, 'CreatePage', 3,' Data',Temp);
% Find the graph layer.
gl = invoke (originObj, 'FindGraphLayer', strGraph);
% Get dataplot collection from the graph layer.
dps = invoke (gl, 'DataPlots');
% Create a data range.
dr = invoke (originObj, 'NewDataRange');
% Add data to data range.
Invoke (dr, 'Add',' X ', wks, 0,0,-1,0);
Invoke (dr, 'Add',' Y ', wks, 0,1,-1,1);
Invoke (dr, 'Add',' Y ', wks, 0,2,-1, 2);
% Add data plot to graph layer.
Invoke (dps, 'Add', dr,200);