Hi Dima:
Set dataplot x/y offset is not supported by Origin C. You can try using Labtalk ( Origin9.0 needed ):
void SetPlotStackOffset(DataPlot& dp, double xOfffset, double yOfffset)
{
GraphLayer gl;
dp.GetParent(gl);
BOOL bX = !is_missing_value(xOfffset);
BOOL bY = !is_missing_value(yOfffset);
string strLTLyaerOffset;
strLTLyaerOffset.Format("layer -b s 4 %d %d;", bX ? 1 : 0, bY ? 1 : 0);
string strMainData = dp.GetDatasetName();
string strLTPlotXOffset;
string strLTPlotYOffset;
if ( bX )
strLTPlotXOffset.Format("set %s -sx %f;", strMainData, xOfffset);
if ( bY )
strLTPlotYOffset.Format("set %s -sy %f;", strMainData, yOfffset);
gl.LT_execute(strLTLyaerOffset + strLTPlotXOffset + strLTPlotYOffset);
}
void test_SetPlotStackOffset()
{
Worksheet wks;
wks.Create("Origin");
Dataset dsX(wks, 0);
Dataset dsY(wks, 1);
dsX.Data(1, 10);
dsY.Data(1, 10);
XYRange xy;
xy.Add(wks, 0, "X");
xy.Add(wks, 1, "Y");
GraphPage gp;
gp.Create("Origin");
GraphLayer gl = gp.Layers();
plot_data_range(xy, gl, IDM_PLOT_LINE, GAP_GROUP_PLOTS | GAP_USE_TEMPLATE | GAP_ALLOW_DUPLICATE_COL, NULL, true);
DataPlot dp = gl.DataPlots();
SetPlotStackOffset(dp, 2, 4);
}
Folger
Originlab Corp.