quote:
Originally posted by couturier
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System: win
I'd like to modify only the plotted subrange of a column.
Assuming I already have the DataPlot dp object:
DataPlotStrings stDescStrs;
int nPlotType = dp.GetPlotType(&stDescStrs);
strY = stDescStrs.szDepRange;
DataRange drY;
okxf_init_range_from_string(&drY, strY);
vector vY;
drY.GetData(&vY, 0);
vY += 1;
drY.SetData(vY);
If plotted part was from row 10 to 20 of col(B), for example:
- rows 1 to 9 are unchanged. Good
- rows 10 to 20 are modified. Good
- rows after 20 are deleted: :-(
I could also get the whole col as a vector, then a subvector to modify, then push back the subvector into whole vector and finally push back the whole vector into the column but it seems to me that makes a lot of unneeded copies.
Is there a simple way to do it ?
With LabTalk, it is as simple as
range rg = 1;
rg += 1;
Thanks
DataPlotStrings is unnecessary in this case. I'm afraid you still have to get the data from row 10 to 20 and set it back, similar to the following:
1) Get DataRange of the DataPlot.DataRange dr;
dp.GetDataRange(dr);
2) Get the first data from row 10 to 20.vector<double> fs;
dr.GetData(fs, 0);
3) Now set it back:fs += 1.0;
dr.SetData(fs, 0);
//dr.SetColumnData(fs, 0);
&&&&&&&&&
&&&
&&
& _____ ___________
II__|[] | | I I |
| |_|_ I I _|
< OO----OOO OO---OO
**********************************************************