The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Data Reader

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
florenciapw Posted - 03/10/2010 : 09:35:01 AM
Origin Ver. and Service Release (Select Help-->About Origin): 8
Operating System: Windows XP

I am a beginner at Origin C (I used to use LabTalk) and I do not get how to manage the DataReader. Could anybody give me a hint? Thanks.
4   L A T E S T    R E P L I E S    (Newest First)
florenciapw Posted - 03/12/2010 : 5:25:48 PM
Thanks a lot!
Penn Posted - 03/12/2010 : 03:24:37 AM
Hi,

In Origin 8.1, you can use method GetGraphPoints::GetData to get plot index of the selected point, then get data range from the plot, and finally get the book name and sheet name.

void test_GetData()
{
    GraphLayer gl = Project.GraphPages(-1).Layers(-1);
    if(!gl)
        return;
    
    int nNumPoints = 2;
    
    GetGraphPoints sp;
    sp.SetFollowData(true, -1);  // not following any data plot
    sp.GetPoints(nNumPoints, gl);  // select two points from graph layer
    
    vector vx, vy;
    vector<int> vnIndices;
    vector<int> vnDataPlotIndices;
    sp.GetData(vx, vy, vnIndices, vnDataPlotIndices);  // get the selected data
    
    for(int iIndex=0; iIndex<vnIndices.GetSize(); iIndex++)
    {
    	out_str("The result of GetPoints:");
    	
    	DataPlot dp = gl.DataPlots(vnDataPlotIndices[iIndex]);  // get the plot
    	if(!dp)
    		continue;
    	
    	DataRange dr;
    	dp.GetDataRange(dr);  // get data range from plot
    	
    	string strBook;
    	string strSheet;
    	dr.GetBookSheet(strBook, strSheet, 0);  // get book name and sheet name
    	
    	printf("Point %d: X=%f, Y=%f, Index=%d, Book=%s, Sheet=%s\n", iIndex+1, vx[iIndex], vy[iIndex], vnIndices[iIndex], strBook, strSheet);
    }
}


If you are using Origin 8, you can download a demo version of Origin 8.1 to have a try.

Penn
OriginLab Technical Services
florenciapw Posted - 03/11/2010 : 12:18:40 PM
Thanks, the example has been very useful. I have another question now. Once I select a point in a graph I need to identify the worksheet that data belongs to, and after that I have to add columns, change column names, etc. How to operate on a worksheet seems easy as far as I understand from the Origin help. The step I do not know how to do is to identify and access the worksheet the data I have selected in the graph belongs to.

Could you help me with that? Thanks.
Penn Posted - 03/11/2010 : 04:52:20 AM
Hi,

You can refer to this example.

Penn
OriginLab Technical Services

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000